diff --git a/sdk/search/Azure.Search.Documents/CHANGELOG.md b/sdk/search/Azure.Search.Documents/CHANGELOG.md index 265b1a0d596c2..c739c0111bd54 100644 --- a/sdk/search/Azure.Search.Documents/CHANGELOG.md +++ b/sdk/search/Azure.Search.Documents/CHANGELOG.md @@ -1,14 +1,9 @@ # Release History -## 11.4.0-beta.7 (Unreleased) +## 11.4.0-beta.7 (2022-03-08) ### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Added support to create, update and delete aliases via the `SearchIndexClient`. ## 11.4.0-beta.6 (2022-02-08) diff --git a/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs b/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs index 96a8c1f431e27..6ad9a43dbdcbf 100644 --- a/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs +++ b/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs @@ -196,14 +196,20 @@ public SearchIndexClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCr public virtual string ServiceName { get { throw null; } } public virtual Azure.Response> AnalyzeText(string indexName, Azure.Search.Documents.Indexes.Models.AnalyzeTextOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> AnalyzeTextAsync(string indexName, Azure.Search.Documents.Indexes.Models.AnalyzeTextOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateAlias(Azure.Search.Documents.Indexes.Models.SearchAlias alias, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateAliasAsync(Azure.Search.Documents.Indexes.Models.SearchAlias alias, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateIndex(Azure.Search.Documents.Indexes.Models.SearchIndex index, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateIndexAsync(Azure.Search.Documents.Indexes.Models.SearchIndex index, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateAlias(string aliasName, Azure.Search.Documents.Indexes.Models.SearchAlias alias, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAliasAsync(string aliasName, Azure.Search.Documents.Indexes.Models.SearchAlias alias, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateOrUpdateIndex(Azure.Search.Documents.Indexes.Models.SearchIndex index, bool allowIndexDowntime = false, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateOrUpdateIndexAsync(Azure.Search.Documents.Indexes.Models.SearchIndex index, bool allowIndexDowntime = false, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateOrUpdateSynonymMap(Azure.Search.Documents.Indexes.Models.SynonymMap synonymMap, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateOrUpdateSynonymMapAsync(Azure.Search.Documents.Indexes.Models.SynonymMap synonymMap, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateSynonymMap(Azure.Search.Documents.Indexes.Models.SynonymMap synonymMap, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateSynonymMapAsync(Azure.Search.Documents.Indexes.Models.SynonymMap synonymMap, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteAlias(string aliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAliasAsync(string aliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeleteIndex(Azure.Search.Documents.Indexes.Models.SearchIndex index, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeleteIndex(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteIndexAsync(Azure.Search.Documents.Indexes.Models.SearchIndex index, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -212,6 +218,10 @@ public SearchIndexClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCr public virtual Azure.Response DeleteSynonymMap(string synonymMapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteSynonymMapAsync(Azure.Search.Documents.Indexes.Models.SynonymMap synonymMap, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteSynonymMapAsync(string synonymMapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAlias(string aliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAliasAsync(string aliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAliases(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAliasesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetIndex(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIndexAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetIndexes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -1762,6 +1772,14 @@ public partial class SearchableField : Azure.Search.Documents.Indexes.Models.Sim public Azure.Search.Documents.Indexes.Models.LexicalAnalyzerName? SearchAnalyzerName { get { throw null; } set { } } public System.Collections.Generic.IList SynonymMapNames { get { throw null; } } } + public partial class SearchAlias + { + public SearchAlias(string name, System.Collections.Generic.IEnumerable indexes) { } + public SearchAlias(string name, string index) { } + public Azure.ETag? ETag { get { throw null; } } + public System.Collections.Generic.IList Indexes { get { throw null; } } + public string Name { get { throw null; } set { } } + } public partial class SearchField { public SearchField(string name, Azure.Search.Documents.Indexes.Models.SearchFieldDataType type) { } @@ -1991,6 +2009,7 @@ public SearchResourceEncryptionKey(System.Uri vaultUri, string keyName, string k public partial class SearchServiceCounters { internal SearchServiceCounters() { } + public Azure.Search.Documents.Indexes.Models.SearchResourceCounter AliasCounter { get { throw null; } } public Azure.Search.Documents.Indexes.Models.SearchResourceCounter DataSourceCounter { get { throw null; } } public Azure.Search.Documents.Indexes.Models.SearchResourceCounter DocumentCounter { get { throw null; } } public Azure.Search.Documents.Indexes.Models.SearchResourceCounter IndexCounter { get { throw null; } } @@ -2950,7 +2969,9 @@ public static partial class SearchModelFactory public static Azure.Search.Documents.Models.SearchResult SearchResult(T document, double? score, System.Collections.Generic.IDictionary> highlights) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.Search.Documents.Indexes.Models.SearchServiceCounters SearchServiceCounters(Azure.Search.Documents.Indexes.Models.SearchResourceCounter documentCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter indexCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter indexerCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter dataSourceCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter storageSizeCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter synonymMapCounter) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.Search.Documents.Indexes.Models.SearchServiceCounters SearchServiceCounters(Azure.Search.Documents.Indexes.Models.SearchResourceCounter documentCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter indexCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter indexerCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter dataSourceCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter storageSizeCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter synonymMapCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter skillsetCounter) { throw null; } + public static Azure.Search.Documents.Indexes.Models.SearchServiceCounters SearchServiceCounters(Azure.Search.Documents.Indexes.Models.SearchResourceCounter aliasCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter documentCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter indexCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter indexerCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter dataSourceCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter storageSizeCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter synonymMapCounter, Azure.Search.Documents.Indexes.Models.SearchResourceCounter skillsetCounter) { throw null; } public static Azure.Search.Documents.Indexes.Models.SearchServiceLimits SearchServiceLimits(int? maxFieldsPerIndex, int? maxFieldNestingDepthPerIndex, int? maxComplexCollectionFieldsPerIndex, int? maxComplexObjectsInCollectionsPerDocument) { throw null; } public static Azure.Search.Documents.Indexes.Models.SearchServiceStatistics SearchServiceStatistics(Azure.Search.Documents.Indexes.Models.SearchServiceCounters counters, Azure.Search.Documents.Indexes.Models.SearchServiceLimits limits) { throw null; } public static Azure.Search.Documents.Models.SearchSuggestion SearchSuggestion(T document, string text) { throw null; } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs new file mode 100644 index 0000000000000..ad76623e19427 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Search.Documents.Indexes.Models; + +namespace Azure.Search.Documents +{ + internal partial class AliasesRestClient + { + private readonly HttpPipeline _pipeline; + private readonly string _endpoint; + private readonly Guid? _xMsClientRequestId; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// Initializes a new instance of AliasesRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The endpoint URL of the search service. + /// The tracking ID sent with the request to help with debugging. + /// Api Version. + /// or is null. + public AliasesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2021-04-30-Preview") + { + _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint)); + _xMsClientRequestId = xMsClientRequestId; + _apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + ClientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateCreateRequest(SearchAlias @alias) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(_endpoint, false); + uri.AppendPath("/aliases", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json; odata.metadata=minimal"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(@alias); + request.Content = content; + return message; + } + + /// Creates a new search alias. + /// The definition of the alias to create. + /// The cancellation token to use. + /// is null. + public async Task> CreateAsync(SearchAlias @alias, CancellationToken cancellationToken = default) + { + if (@alias == null) + { + throw new ArgumentNullException(nameof(@alias)); + } + + using var message = CreateCreateRequest(@alias); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + { + SearchAlias value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SearchAlias.DeserializeSearchAlias(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await ClientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a new search alias. + /// The definition of the alias to create. + /// The cancellation token to use. + /// is null. + public Response Create(SearchAlias @alias, CancellationToken cancellationToken = default) + { + if (@alias == null) + { + throw new ArgumentNullException(nameof(@alias)); + } + + using var message = CreateCreateRequest(@alias); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + { + SearchAlias value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SearchAlias.DeserializeSearchAlias(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw ClientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(_endpoint, false); + uri.AppendPath("/aliases", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json; odata.metadata=minimal"); + return message; + } + + /// Lists all aliases available for a search service. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ListAliasesResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ListAliasesResult.DeserializeListAliasesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await ClientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists all aliases available for a search service. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ListAliasesResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ListAliasesResult.DeserializeListAliasesResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw ClientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string aliasName, SearchAlias @alias, string ifMatch, string ifNoneMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(_endpoint, false); + uri.AppendPath("/aliases('", false); + uri.AppendPath(aliasName, true); + uri.AppendPath("')", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Prefer", "return=representation"); + request.Headers.Add("Accept", "application/json; odata.metadata=minimal"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(@alias); + request.Content = content; + return message; + } + + /// Creates a new search alias or updates an alias if it already exists. + /// The definition of the alias to create or update. + /// The definition of the alias to create or update. + /// Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value. + /// Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. + /// The cancellation token to use. + /// or is null. + public async Task> CreateOrUpdateAsync(string aliasName, SearchAlias @alias, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + if (aliasName == null) + { + throw new ArgumentNullException(nameof(aliasName)); + } + if (@alias == null) + { + throw new ArgumentNullException(nameof(@alias)); + } + + using var message = CreateCreateOrUpdateRequest(aliasName, @alias, ifMatch, ifNoneMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + SearchAlias value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SearchAlias.DeserializeSearchAlias(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await ClientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates a new search alias or updates an alias if it already exists. + /// The definition of the alias to create or update. + /// The definition of the alias to create or update. + /// Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value. + /// Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. + /// The cancellation token to use. + /// or is null. + public Response CreateOrUpdate(string aliasName, SearchAlias @alias, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + if (aliasName == null) + { + throw new ArgumentNullException(nameof(aliasName)); + } + if (@alias == null) + { + throw new ArgumentNullException(nameof(@alias)); + } + + using var message = CreateCreateOrUpdateRequest(aliasName, @alias, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + SearchAlias value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SearchAlias.DeserializeSearchAlias(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw ClientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string aliasName, string ifMatch, string ifNoneMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(_endpoint, false); + uri.AppendPath("/aliases('", false); + uri.AppendPath(aliasName, true); + uri.AppendPath("')", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Accept", "application/json; odata.metadata=minimal"); + return message; + } + + /// Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery option. The mapped index is untouched by this operation. + /// The name of the alias to delete. + /// Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value. + /// Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. + /// The cancellation token to use. + /// is null. + public async Task DeleteAsync(string aliasName, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + if (aliasName == null) + { + throw new ArgumentNullException(nameof(aliasName)); + } + + using var message = CreateDeleteRequest(aliasName, ifMatch, ifNoneMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw await ClientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery option. The mapped index is untouched by this operation. + /// The name of the alias to delete. + /// Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value. + /// Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. + /// The cancellation token to use. + /// is null. + public Response Delete(string aliasName, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + if (aliasName == null) + { + throw new ArgumentNullException(nameof(aliasName)); + } + + using var message = CreateDeleteRequest(aliasName, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw ClientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string aliasName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(_endpoint, false); + uri.AppendPath("/aliases('", false); + uri.AppendPath(aliasName, true); + uri.AppendPath("')", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json; odata.metadata=minimal"); + return message; + } + + /// Retrieves an alias definition. + /// The name of the alias to retrieve. + /// The cancellation token to use. + /// is null. + public async Task> GetAsync(string aliasName, CancellationToken cancellationToken = default) + { + if (aliasName == null) + { + throw new ArgumentNullException(nameof(aliasName)); + } + + using var message = CreateGetRequest(aliasName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SearchAlias value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SearchAlias.DeserializeSearchAlias(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await ClientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Retrieves an alias definition. + /// The name of the alias to retrieve. + /// The cancellation token to use. + /// is null. + public Response Get(string aliasName, CancellationToken cancellationToken = default) + { + if (aliasName == null) + { + throw new ArgumentNullException(nameof(aliasName)); + } + + using var message = CreateGetRequest(aliasName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SearchAlias value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SearchAlias.DeserializeSearchAlias(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw ClientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/ListAliasesResult.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/ListAliasesResult.Serialization.cs new file mode 100644 index 0000000000000..18f8b666d9f41 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/ListAliasesResult.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Search.Documents.Indexes.Models +{ + internal partial class ListAliasesResult + { + internal static ListAliasesResult DeserializeListAliasesResult(JsonElement element) + { + IReadOnlyList value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SearchAlias.DeserializeSearchAlias(item)); + } + value = array; + continue; + } + } + return new ListAliasesResult(value); + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/ListAliasesResult.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/ListAliasesResult.cs new file mode 100644 index 0000000000000..4474c161b8efb --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/ListAliasesResult.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// Response from a List Aliases request. If successful, it includes the associated index mappings for all aliases. + internal partial class ListAliasesResult + { + /// Initializes a new instance of ListAliasesResult. + /// The aliases in the Search service. + /// is null. + internal ListAliasesResult(IEnumerable aliases) + { + if (aliases == null) + { + throw new ArgumentNullException(nameof(aliases)); + } + + Aliases = aliases.ToList(); + } + + /// Initializes a new instance of ListAliasesResult. + /// The aliases in the Search service. + internal ListAliasesResult(IReadOnlyList aliases) + { + Aliases = aliases; + } + + /// The aliases in the Search service. + public IReadOnlyList Aliases { get; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchAlias.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchAlias.Serialization.cs new file mode 100644 index 0000000000000..d9eeb8bd77d1f --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchAlias.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Search.Documents.Indexes.Models +{ + public partial class SearchAlias : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + writer.WritePropertyName("indexes"); + writer.WriteStartArray(); + foreach (var item in Indexes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(_etag)) + { + writer.WritePropertyName("@odata.etag"); + writer.WriteStringValue(_etag); + } + writer.WriteEndObject(); + } + + internal static SearchAlias DeserializeSearchAlias(JsonElement element) + { + string name = default; + IList indexes = default; + Optional odataEtag = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("indexes")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + indexes = array; + continue; + } + if (property.NameEquals("@odata.etag")) + { + odataEtag = property.Value.GetString(); + continue; + } + } + return new SearchAlias(name, indexes, odataEtag.Value); + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchAlias.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchAlias.cs new file mode 100644 index 0000000000000..cb2c491889026 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchAlias.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Search.Documents.Indexes.Models +{ + /// Represents an index alias, which describes a mapping from the alias name to an index. The alias name can be used in place of the index name for supported operations. + public partial class SearchAlias + { + /// Initializes a new instance of SearchAlias. + /// The name of the alias. + /// The name of the index this alias maps to. Only one index name may be specified. + /// or is null. + public SearchAlias(string name, IEnumerable indexes) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + if (indexes == null) + { + throw new ArgumentNullException(nameof(indexes)); + } + + Name = name; + Indexes = indexes.ToList(); + } + + /// Initializes a new instance of SearchAlias. + /// The name of the alias. + /// The name of the index this alias maps to. Only one index name may be specified. + /// The ETag of the alias. + internal SearchAlias(string name, IList indexes, string etag) + { + Name = name; + Indexes = indexes; + _etag = etag; + } + + /// The name of the alias. + public string Name { get; set; } + /// The name of the index this alias maps to. Only one index name may be specified. + public IList Indexes { get; } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchServiceCounters.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchServiceCounters.Serialization.cs index 88407934507c6..5cfc30ed3dc1c 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchServiceCounters.Serialization.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchServiceCounters.Serialization.cs @@ -14,6 +14,7 @@ public partial class SearchServiceCounters { internal static SearchServiceCounters DeserializeSearchServiceCounters(JsonElement element) { + Optional aliasesCount = default; SearchResourceCounter documentCount = default; SearchResourceCounter indexesCount = default; SearchResourceCounter indexersCount = default; @@ -23,6 +24,16 @@ internal static SearchServiceCounters DeserializeSearchServiceCounters(JsonEleme Optional skillsetCount = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("aliasesCount")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + aliasesCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value); + continue; + } if (property.NameEquals("documentCount")) { documentCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value); @@ -64,7 +75,7 @@ internal static SearchServiceCounters DeserializeSearchServiceCounters(JsonEleme continue; } } - return new SearchServiceCounters(documentCount, indexesCount, indexersCount, dataSourcesCount, storageSize, synonymMaps, skillsetCount.Value); + return new SearchServiceCounters(aliasesCount.Value, documentCount, indexesCount, indexersCount, dataSourcesCount, storageSize, synonymMaps, skillsetCount.Value); } } } diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchServiceCounters.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchServiceCounters.cs index 05faeaea0278a..0f24367bafac6 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchServiceCounters.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SearchServiceCounters.cs @@ -55,6 +55,8 @@ internal SearchServiceCounters(SearchResourceCounter documentCounter, SearchReso SynonymMapCounter = synonymMapCounter; } + /// Total number of aliases. + public SearchResourceCounter AliasCounter { get; } /// Total number of documents across all indexes in the service. public SearchResourceCounter DocumentCounter { get; } /// Total number of indexes. diff --git a/sdk/search/Azure.Search.Documents/src/Indexes/Models/SearchAlias.cs b/sdk/search/Azure.Search.Documents/src/Indexes/Models/SearchAlias.cs new file mode 100644 index 0000000000000..60fd78d8de3c3 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Indexes/Models/SearchAlias.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System; +using Azure.Core; + +namespace Azure.Search.Documents.Indexes.Models +{ + public partial class SearchAlias + { + [CodeGenMember("etag")] + private readonly string _etag; + + /// + /// The of the . + /// + public ETag? ETag + { + get => _etag is null ? null : new ETag(_etag); + } + + /// Initializes a new instance of SearchAlias. + /// The name of the alias. + /// The name of the index this alias maps to. + /// or is null. + public SearchAlias(string name, string index) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Indexes = (index != null) ? new List { index } : throw new ArgumentNullException(nameof(index)); + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Indexes/Models/SearchServiceCounters.cs b/sdk/search/Azure.Search.Documents/src/Indexes/Models/SearchServiceCounters.cs index ed46a2b4075b1..1435a8f7ef126 100644 --- a/sdk/search/Azure.Search.Documents/src/Indexes/Models/SearchServiceCounters.cs +++ b/sdk/search/Azure.Search.Documents/src/Indexes/Models/SearchServiceCounters.cs @@ -10,6 +10,7 @@ namespace Azure.Search.Documents.Indexes.Models public partial class SearchServiceCounters { /// Initializes a new instance of SearchServiceCounters. + /// Total number of aliases. /// Total number of documents across all indexes in the service. /// Total number of indexes. /// Total number of indexers. @@ -19,6 +20,7 @@ public partial class SearchServiceCounters /// Total number of skillsets. /// , , , , , or is null. internal SearchServiceCounters( + SearchResourceCounter aliasCounter, SearchResourceCounter documentCounter, SearchResourceCounter indexCounter, SearchResourceCounter indexerCounter, @@ -27,6 +29,7 @@ internal SearchServiceCounters( SearchResourceCounter synonymMapCounter, SearchResourceCounter skillsetCounter) { + AliasCounter = aliasCounter; DocumentCounter = documentCounter ?? throw new ArgumentNullException(nameof(documentCounter)); IndexCounter = indexCounter ?? throw new ArgumentNullException(nameof(indexCounter)); IndexerCounter = indexerCounter ?? throw new ArgumentNullException(nameof(indexerCounter)); diff --git a/sdk/search/Azure.Search.Documents/src/Indexes/SearchIndexClient.Aliases.cs b/sdk/search/Azure.Search.Documents/src/Indexes/SearchIndexClient.Aliases.cs new file mode 100644 index 0000000000000..50c64738d7fe9 --- /dev/null +++ b/sdk/search/Azure.Search.Documents/src/Indexes/SearchIndexClient.Aliases.cs @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Search.Documents.Indexes.Models; + +namespace Azure.Search.Documents.Indexes +{ + /// + /// Azure Cognitive Search client that can be used to manage indexes on a Search service. + /// + public partial class SearchIndexClient + { + private AliasesRestClient _aliasesRestClient; + + /// + /// Gets the generated to make requests. + /// + private AliasesRestClient AliasesClient => LazyInitializer.EnsureInitialized(ref _aliasesRestClient, () => new AliasesRestClient( + _clientDiagnostics, + _pipeline, + Endpoint.AbsoluteUri, + null, + _version.ToVersionString()) + ); + + /// + /// Creates a new search alias. + /// + /// The definition of the alias to create. + /// Optional to propagate notifications that the operation should be canceled. + /// created by the service. + public virtual Response CreateAlias(SearchAlias alias, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(CreateAlias)}"); + scope.Start(); + try + { + return AliasesClient.Create(alias, cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Creates a new search alias. + /// + /// The definition of the alias to create. + /// Optional to propagate notifications that the operation should be canceled. + /// created by the service. + public virtual async Task> CreateAliasAsync(SearchAlias alias, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(CreateAlias)}"); + scope.Start(); + try + { + return await AliasesClient.CreateAsync(alias, cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Creates a new search alias or updates an alias if it already exists. + /// + /// The name of the alias to create or update. + /// The definition of the alias to create or update. + /// + /// True to throw a if the does not match the current alias version; + /// otherwise, the current version will be overwritten. + /// + /// Optional to propagate notifications that the operation should be canceled. + /// defined by aliasName. + public virtual Response CreateOrUpdateAlias(string aliasName, SearchAlias alias, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(CreateOrUpdateAlias)}"); + scope.Start(); + try + { + return AliasesClient.CreateOrUpdate(aliasName, alias, onlyIfUnchanged ? alias.ETag?.ToString() : null, null, cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Creates a new search alias or updates an alias if it already exists. + /// + /// The name of the alias to create or update. + /// The definition of the alias to create or update. + /// + /// True to throw a if the does not match the current alias version; + /// otherwise, the current version will be overwritten. + /// + /// Optional to propagate notifications that the operation should be canceled. + /// defined by aliasName. + public virtual async Task> CreateOrUpdateAliasAsync(string aliasName, SearchAlias alias, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(CreateOrUpdateAlias)}"); + scope.Start(); + try + { + return await AliasesClient.CreateOrUpdateAsync(aliasName, alias, onlyIfUnchanged ? alias.ETag?.ToString() : null, null, cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery option. The mapped index is untouched by this operation. + /// + /// The name of the alias to delete. + /// Optional to propagate notifications that the operation should be canceled. + /// from the service. + public virtual Response DeleteAlias(string aliasName, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(DeleteAlias)}"); + scope.Start(); + try + { + return AliasesClient.Delete(aliasName, null, null, cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery option. The mapped index is untouched by this operation. + /// + /// The name of the alias to delete. + /// Optional to propagate notifications that the operation should be canceled. + /// from the service. + public virtual async Task DeleteAliasAsync(string aliasName, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(DeleteAlias)}"); + scope.Start(); + try + { + return await AliasesClient.DeleteAsync(aliasName, null, null, cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Retrieves an alias definition. + /// + /// The name of the alias to retrieve. + /// Optional to propagate notifications that the operation should be canceled. + /// defined by aliasName. + public virtual Response GetAlias(string aliasName, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(GetAlias)}"); + scope.Start(); + try + { + return AliasesClient.Get(aliasName, cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Retrieves an alias definition. + /// + /// The name of the alias to retrieve. + /// Optional to propagate notifications that the operation should be canceled. + /// defined by aliasName. + public virtual async Task> GetAliasAsync(string aliasName, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(GetAlias)}"); + scope.Start(); + try + { + return await AliasesClient.GetAsync(aliasName, cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Gets a list of all alias definitions available for a search service. + /// + /// Optional to propagate notifications that the operation should be canceled. + /// The from the server containing a list of objects. + /// Thrown when a failure is returned by the Search service. + public virtual Pageable GetAliases(CancellationToken cancellationToken = default) + { + return PageResponseEnumerator.CreateEnumerable((continuationToken) => + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(GetAliases)}"); + scope.Start(); + try + { + if (continuationToken != null) + { + throw new NotSupportedException("A continuation token is unsupported."); + } + + Response result = AliasesClient.List(cancellationToken); + + return Page.FromValues(result.Value.Aliases, null, result.GetRawResponse()); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + }); + } + + /// + /// Gets a list of all alias definitions available for a search service. + /// + /// Optional to propagate notifications that the operation should be canceled. + /// The from the server containing a list of objects. + /// Thrown when a failure is returned by the Search service. + public virtual AsyncPageable GetAliasesAsync(CancellationToken cancellationToken = default) + { + return PageResponseEnumerator.CreateAsyncEnumerable(async (continuationToken) => + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(SearchIndexClient)}.{nameof(GetAliases)}"); + scope.Start(); + try + { + if (continuationToken != null) + { + throw new NotSupportedException("A continuation token is unsupported."); + } + + Response result = await AliasesClient.ListAsync(cancellationToken).ConfigureAwait(false); + + return Page.FromValues(result.Value.Aliases, null, result.GetRawResponse()); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + }); + } + } +} diff --git a/sdk/search/Azure.Search.Documents/src/Indexes/SearchIndexClient.cs b/sdk/search/Azure.Search.Documents/src/Indexes/SearchIndexClient.cs index 99f308fcc5c28..de9bef725159d 100644 --- a/sdk/search/Azure.Search.Documents/src/Indexes/SearchIndexClient.cs +++ b/sdk/search/Azure.Search.Documents/src/Indexes/SearchIndexClient.cs @@ -17,7 +17,7 @@ namespace Azure.Search.Documents.Indexes /// /// Azure Cognitive Search client that can be used to manage indexes on a Search service. /// - public class SearchIndexClient + public partial class SearchIndexClient { private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; diff --git a/sdk/search/Azure.Search.Documents/src/Models/SearchModelFactory.cs b/sdk/search/Azure.Search.Documents/src/Models/SearchModelFactory.cs index 7880dbc6b5ec6..0e5d998d29e22 100644 --- a/sdk/search/Azure.Search.Documents/src/Models/SearchModelFactory.cs +++ b/sdk/search/Azure.Search.Documents/src/Models/SearchModelFactory.cs @@ -230,7 +230,29 @@ public static SearchServiceCounters SearchServiceCounters( /// Total number of synonym maps. /// Total number of skillsets. /// A new SearchServiceCounters instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static SearchServiceCounters SearchServiceCounters( + SearchResourceCounter documentCounter, + SearchResourceCounter indexCounter, + SearchResourceCounter indexerCounter, + SearchResourceCounter dataSourceCounter, + SearchResourceCounter storageSizeCounter, + SearchResourceCounter synonymMapCounter, + SearchResourceCounter skillsetCounter) => + SearchServiceCounters(null, documentCounter, indexCounter, indexerCounter, dataSourceCounter, storageSizeCounter, synonymMapCounter, skillsetCounter); + + /// Initializes a new instance of SearchServiceCounters. + /// Total number of aliases. + /// Total number of documents across all indexes in the service. + /// Total number of indexes. + /// Total number of indexers. + /// Total number of data sources. + /// Total size of used storage in bytes. + /// Total number of synonym maps. + /// Total number of skillsets. + /// A new SearchServiceCounters instance for mocking. public static SearchServiceCounters SearchServiceCounters( + SearchResourceCounter aliasCounter, SearchResourceCounter documentCounter, SearchResourceCounter indexCounter, SearchResourceCounter indexerCounter, @@ -238,7 +260,7 @@ public static SearchServiceCounters SearchServiceCounters( SearchResourceCounter storageSizeCounter, SearchResourceCounter synonymMapCounter, SearchResourceCounter skillsetCounter) => - new SearchServiceCounters(documentCounter, indexCounter, indexerCounter, dataSourceCounter, storageSizeCounter, synonymMapCounter, skillsetCounter); + new(aliasCounter, documentCounter, indexCounter, indexerCounter, dataSourceCounter, storageSizeCounter, synonymMapCounter, skillsetCounter); /// Initializes a new instance of SearchServiceLimits. /// The maximum allowed fields per index. diff --git a/sdk/search/Azure.Search.Documents/src/autorest.md b/sdk/search/Azure.Search.Documents/src/autorest.md index 97a3109dcdaf0..2d9af4dbbe26e 100644 --- a/sdk/search/Azure.Search.Documents/src/autorest.md +++ b/sdk/search/Azure.Search.Documents/src/autorest.md @@ -11,8 +11,8 @@ See the [Contributing guidelines](https://github.com/Azure/azure-sdk-for-net/blo ```yaml title: SearchServiceClient input-file: - - https://github.com/Azure/azure-rest-api-specs/blob/932e261a870475e1a29115f62def7bb84e4d7b38/specification/search/data-plane/Azure.Search/preview/2021-04-30-Preview/searchindex.json - - https://github.com/Azure/azure-rest-api-specs/blob/932e261a870475e1a29115f62def7bb84e4d7b38/specification/search/data-plane/Azure.Search/preview/2021-04-30-Preview/searchservice.json + - https://github.com/Azure/azure-rest-api-specs/blob/d850f41f89530917000d8e6bb463f42bb745b930/specification/search/data-plane/Azure.Search/preview/2021-04-30-Preview/searchindex.json + - https://github.com/Azure/azure-rest-api-specs/blob/d850f41f89530917000d8e6bb463f42bb745b930/specification/search/data-plane/Azure.Search/preview/2021-04-30-Preview/searchservice.json modelerfour: seal-single-value-enum-by-default: true ```