Skip to content

Commit

Permalink
Define onlyIfUnchanged parameter for CreateOrUpdate and Delete operat…
Browse files Browse the repository at this point in the history
…ions (#11420)

* Combine MatchConditions and SearchRequestOptions

Fixes #11052

* Redefine ETag properties as Azure.ETag?

Fixes #11385

* Update public APIs

* Define onlyIfUnchanged for ETag support (#2)

This was suggested to match what AppConfiguration does. It simplifies it, with no practical reason for IfNoneMatch. We could always add that later as well.

* Update CHANGELOG and public APIs
  • Loading branch information
heaths authored Apr 28, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 860b511 commit a833bc0
Showing 27 changed files with 571 additions and 302 deletions.
2 changes: 2 additions & 0 deletions sdk/search/Azure.Search.Documents/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@

- Removed constructor from `SynonymMap` with `IEnumerable<string>` parameter.
- `SearchServiceClient.GetIndexes` and `SearchServiceClient.GetIndexesAsync` now return `Pageable<SearchIndex>` and `AsyncPageable<SearchIndex>` respectively.
- Replaced `MatchConditions` parameters with `bool onlyIfUnchanged` parameters that require a model with an `ETag` property.
- `ETag` properties have been redefined from `string` to `Azure.ETag?` consistent with other packages.

## 1.0.0-preview.2 (2020-04-06)

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions sdk/search/Azure.Search.Documents/src/Models/DataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core;

namespace Azure.Search.Documents.Models
{
public partial class DataSource
{
[CodeGenMember("etag")]
private string _etag;

/// <summary>
/// The <see cref="Azure.ETag"/> of the <see cref="DataSource"/>.
/// </summary>
public ETag? ETag
{
get => _etag is null ? (ETag?)null : new ETag(_etag);
set => _etag = value?.ToString();
}
}
}
12 changes: 11 additions & 1 deletion sdk/search/Azure.Search.Documents/src/Models/SearchIndex.cs
Original file line number Diff line number Diff line change
@@ -10,7 +10,8 @@ namespace Azure.Search.Documents.Models
[CodeGenModel("Index")]
public partial class SearchIndex
{
// TODO: Replace constructor and read-only properties when https://github.com/Azure/autorest.csharp/issues/554 is fixed.
[CodeGenMember("etag")]
private string _etag;

/// <summary>
/// Initializes a new instance of the <see cref="SearchIndex"/> class.
@@ -105,5 +106,14 @@ public SearchIndex(string name, IEnumerable<SearchField> fields)
/// </summary>
[CodeGenMember(Initialize = true, EmptyAsUndefined = true)]
public IList<Tokenizer> Tokenizers { get; }

/// <summary>
/// The <see cref="Azure.ETag"/> of the <see cref="SearchIndex"/>.
/// </summary>
public ETag? ETag
{
get => _etag is null ? (ETag?)null : new ETag(_etag);
set => _etag = value?.ToString();
}
}
}
11 changes: 11 additions & 0 deletions sdk/search/Azure.Search.Documents/src/Models/SearchIndexer.cs
Original file line number Diff line number Diff line change
@@ -8,5 +8,16 @@ namespace Azure.Search.Documents.Models
[CodeGenModel("Indexer")]
public partial class SearchIndexer
{
[CodeGenMember("etag")]
private string _etag;

/// <summary>
/// The <see cref="Azure.ETag"/> of the <see cref="SearchIndexer"/>.
/// </summary>
public ETag? ETag
{
get => _etag is null ? (ETag?)null : new ETag(_etag);
set => _etag = value?.ToString();
}
}
}
22 changes: 22 additions & 0 deletions sdk/search/Azure.Search.Documents/src/Models/Skillset.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core;

namespace Azure.Search.Documents.Models
{
public partial class Skillset
{
[CodeGenMember("etag")]
private string _etag;

/// <summary>
/// The <see cref="Azure.ETag"/> of the <see cref="Skillset"/>.
/// </summary>
public ETag? ETag
{
get => _etag is null ? (ETag?)null : new ETag(_etag);
set => _etag = value?.ToString();
}
}
}
12 changes: 12 additions & 0 deletions sdk/search/Azure.Search.Documents/src/Models/SynonymMap.cs
Original file line number Diff line number Diff line change
@@ -14,6 +14,9 @@ public partial class SynonymMap
{
private const string DefaultFormat = "solr";

[CodeGenMember("etag")]
private string _etag;

// TODO: Replace constructor and read-only properties when https://github.com/Azure/autorest.csharp/issues/554 is fixed.

/// <summary>
@@ -56,6 +59,15 @@ public SynonymMap(string name, TextReader reader)
Synonyms = reader.ReadToEnd();
}

/// <summary>
/// The <see cref="Azure.ETag"/> of the <see cref="SynonymMap"/>.
/// </summary>
public ETag? ETag
{
get => _etag is null ? (ETag?)null : new ETag(_etag);
set => _etag = value?.ToString();
}

/// <summary>
/// Canonicalizes property names from how they appear on <see cref="SynonymMap"/> to those expected by the Search service.
/// </summary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.Search.Documents
{
/// <summary>
/// Options to customize Search service operations conditioned on <see cref="IfMatch"/> or <see cref="IfNoneMatch"/> ETags.
/// </summary>
public class SearchConditionalOptions : SearchRequestOptions
{
/// <summary>
/// Optionally limit requests to resources that have a matching ETag.
/// </summary>
public ETag? IfMatch { get; set; }

/// <summary>
/// Optionally limit requests to resources that do not match the ETag.
/// </summary>
public ETag? IfNoneMatch { get; set; }
}
}
Loading

0 comments on commit a833bc0

Please sign in to comment.