diff --git a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/ISearchServiceClient.cs b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/ISearchServiceClient.cs index a9f857b6aca0..549b76cefb76 100644 --- a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/ISearchServiceClient.cs +++ b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/ISearchServiceClient.cs @@ -14,6 +14,10 @@ namespace Microsoft.Azure.Search using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// Client that can be used to manage and query indexes and documents, as @@ -94,5 +98,19 @@ public partial interface ISearchServiceClient : System.IDisposable /// IIndexesOperations Indexes { get; } + /// + /// Gets service level statistics for an Azure Search service. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetServiceStatisticsWithHttpMessagesAsync(SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } } diff --git a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ResourceCounter.cs b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ResourceCounter.cs new file mode 100644 index 000000000000..4e4ffbcf60c4 --- /dev/null +++ b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ResourceCounter.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Search.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a resource's usage and quota. + /// + public partial class ResourceCounter + { + /// + /// Initializes a new instance of the ResourceCounter class. + /// + public ResourceCounter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceCounter class. + /// + /// The resource usage amount. + /// The resource amount quota. + public ResourceCounter(long usage = default(long), long? quota = default(long?)) + { + Usage = usage; + Quota = quota; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource usage amount. + /// + [JsonProperty(PropertyName = "usage")] + public long Usage { get; set; } + + /// + /// Gets or sets the resource amount quota. + /// + [JsonProperty(PropertyName = "quota")] + public long? Quota { get; set; } + + } +} diff --git a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ServiceCounters.cs b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ServiceCounters.cs new file mode 100644 index 000000000000..5c601c78e358 --- /dev/null +++ b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ServiceCounters.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Search.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents service-level resource counters and quotas. + /// + public partial class ServiceCounters + { + /// + /// Initializes a new instance of the ServiceCounters class. + /// + public ServiceCounters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceCounters class. + /// + /// 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. + public ServiceCounters(ResourceCounter documentCounter = default(ResourceCounter), ResourceCounter indexCounter = default(ResourceCounter), ResourceCounter indexerCounter = default(ResourceCounter), ResourceCounter dataSourceCounter = default(ResourceCounter), ResourceCounter storageSizeCounter = default(ResourceCounter), ResourceCounter synonymMapCounter = default(ResourceCounter)) + { + DocumentCounter = documentCounter; + IndexCounter = indexCounter; + IndexerCounter = indexerCounter; + DataSourceCounter = dataSourceCounter; + StorageSizeCounter = storageSizeCounter; + SynonymMapCounter = synonymMapCounter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets total number of documents across all indexes in the + /// service. + /// + [JsonProperty(PropertyName = "documentCount")] + public ResourceCounter DocumentCounter { get; set; } + + /// + /// Gets or sets total number of indexes. + /// + [JsonProperty(PropertyName = "indexesCount")] + public ResourceCounter IndexCounter { get; set; } + + /// + /// Gets or sets total number of indexers. + /// + [JsonProperty(PropertyName = "indexersCount")] + public ResourceCounter IndexerCounter { get; set; } + + /// + /// Gets or sets total number of data sources. + /// + [JsonProperty(PropertyName = "dataSourcesCount")] + public ResourceCounter DataSourceCounter { get; set; } + + /// + /// Gets or sets total size of used storage in bytes. + /// + [JsonProperty(PropertyName = "storageSize")] + public ResourceCounter StorageSizeCounter { get; set; } + + /// + /// Gets or sets total number of synonym maps. + /// + [JsonProperty(PropertyName = "synonymMaps")] + public ResourceCounter SynonymMapCounter { get; set; } + + } +} diff --git a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ServiceLimits.cs b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ServiceLimits.cs new file mode 100644 index 000000000000..86b731f55150 --- /dev/null +++ b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ServiceLimits.cs @@ -0,0 +1,111 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Search.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents various service level limits. + /// + public partial class ServiceLimits + { + /// + /// Initializes a new instance of the ServiceLimits class. + /// + public ServiceLimits() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceLimits class. + /// + /// The maximum allowed fields per + /// index. + /// The maximum time an indexer will + /// run in a single execution. In the next run, indexing will resume at + /// the point where it stopped. + /// When using a blob indexer, if + /// the size in bytes of a blob's content is larger than this size, it + /// results in an error. + /// The maximum number + /// of characters extracted from a blob when using a blob indexer. If a + /// blob has more content, it is not indexed and a warning is added to + /// the indexer execution result. + /// The maximum depth which + /// you can nest sub-fields in an index, including the top-level + /// complex field. For example, a/b/c has a nesting depth of 3. + /// The maximum number + /// of fields of type Collection(Edm.ComplexType) allowed in an + /// index. + public ServiceLimits(int? maxFieldsPerIndex = default(int?), System.TimeSpan? maxIndexerRunTime = default(System.TimeSpan?), long? maxFileExtractionSize = default(long?), int? maxFileContentCharactersToExtract = default(int?), int? maxFieldNestingDepthPerIndex = default(int?), int? maxComplexCollectionFieldsPerIndex = default(int?)) + { + MaxFieldsPerIndex = maxFieldsPerIndex; + MaxIndexerRunTime = maxIndexerRunTime; + MaxFileExtractionSize = maxFileExtractionSize; + MaxFileContentCharactersToExtract = maxFileContentCharactersToExtract; + MaxFieldNestingDepthPerIndex = maxFieldNestingDepthPerIndex; + MaxComplexCollectionFieldsPerIndex = maxComplexCollectionFieldsPerIndex; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the maximum allowed fields per index. + /// + [JsonProperty(PropertyName = "maxFieldsPerIndex")] + public int? MaxFieldsPerIndex { get; set; } + + /// + /// Gets or sets the maximum time an indexer will run in a single + /// execution. In the next run, indexing will resume at the point where + /// it stopped. + /// + [JsonProperty(PropertyName = "maxIndexerRunTime")] + public System.TimeSpan? MaxIndexerRunTime { get; set; } + + /// + /// Gets or sets when using a blob indexer, if the size in bytes of a + /// blob's content is larger than this size, it results in an error. + /// + [JsonProperty(PropertyName = "maxFileExtractionSize")] + public long? MaxFileExtractionSize { get; set; } + + /// + /// Gets or sets the maximum number of characters extracted from a blob + /// when using a blob indexer. If a blob has more content, it is not + /// indexed and a warning is added to the indexer execution result. + /// + [JsonProperty(PropertyName = "maxFileContentCharactersToExtract")] + public int? MaxFileContentCharactersToExtract { get; set; } + + /// + /// Gets or sets the maximum depth which you can nest sub-fields in an + /// index, including the top-level complex field. For example, a/b/c + /// has a nesting depth of 3. + /// + [JsonProperty(PropertyName = "maxFieldNestingDepthPerIndex")] + public int? MaxFieldNestingDepthPerIndex { get; set; } + + /// + /// Gets or sets the maximum number of fields of type + /// Collection(Edm.ComplexType) allowed in an index. + /// + [JsonProperty(PropertyName = "maxComplexCollectionFieldsPerIndex")] + public int? MaxComplexCollectionFieldsPerIndex { get; set; } + + } +} diff --git a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ServiceStatistics.cs b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ServiceStatistics.cs new file mode 100644 index 000000000000..9c10ea69b8b6 --- /dev/null +++ b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/Models/ServiceStatistics.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Search.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Response from a get service statistics request. If successful, it + /// includes service level counters and limits. + /// + public partial class ServiceStatistics + { + /// + /// Initializes a new instance of the ServiceStatistics class. + /// + public ServiceStatistics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceStatistics class. + /// + /// Service level resource counters. + /// Service level general limits. + public ServiceStatistics(ServiceCounters counters = default(ServiceCounters), ServiceLimits limits = default(ServiceLimits)) + { + Counters = counters; + Limits = limits; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service level resource counters. + /// + [JsonProperty(PropertyName = "counters")] + public ServiceCounters Counters { get; set; } + + /// + /// Gets or sets service level general limits. + /// + [JsonProperty(PropertyName = "limits")] + public ServiceLimits Limits { get; set; } + + } +} diff --git a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SdkInfo_SearchServiceClient.cs b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SdkInfo_SearchServiceClient.cs index fabf67bc3ad8..5b7573cff0c6 100644 --- a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SdkInfo_SearchServiceClient.cs +++ b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SdkInfo_SearchServiceClient.cs @@ -12,6 +12,7 @@ public static IEnumerable> ApiInfo_SearchServiceCl return new Tuple[] { new Tuple("SearchServiceClient", "DataSources", "2016-09-01-Preview"), + new Tuple("SearchServiceClient", "GetServiceStatistics", "2016-09-01-Preview"), new Tuple("SearchServiceClient", "Indexers", "2016-09-01-Preview"), new Tuple("SearchServiceClient", "Indexes", "2016-09-01-Preview"), new Tuple("SearchServiceClient", "SynonymMaps", "2016-09-01-Preview"), diff --git a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SearchServiceClient.cs b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SearchServiceClient.cs index 39d9c87352d5..c432893c3854 100644 --- a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SearchServiceClient.cs +++ b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SearchServiceClient.cs @@ -20,6 +20,8 @@ namespace Microsoft.Azure.Search using System.Linq; using System.Net; using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; /// /// Client that can be used to manage and query indexes and documents, as @@ -239,5 +241,205 @@ private void Initialize() CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } + /// + /// Gets service level statistics for an Azure Search service. + /// + /// + /// Additional parameters for the operation + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetServiceStatisticsWithHttpMessagesAsync(SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SearchServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SearchServiceName"); + } + if (SearchDnsSuffix == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SearchDnsSuffix"); + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + System.Guid? clientRequestId = default(System.Guid?); + if (searchRequestOptions != null) + { + clientRequestId = searchRequestOptions.ClientRequestId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("clientRequestId", clientRequestId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetServiceStatistics", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "servicestats"; + _url = _url.Replace("{searchServiceName}", SearchServiceName); + _url = _url.Replace("{searchDnsSuffix}", SearchDnsSuffix); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + if (clientRequestId != null) + { + if (_httpRequest.Headers.Contains("client-request-id")) + { + _httpRequest.Headers.Remove("client-request-id"); + } + _httpRequest.Headers.TryAddWithoutValidation("client-request-id", SafeJsonConvert.SerializeObject(clientRequestId, SerializationSettings).Trim('"')); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SearchServiceClientExtensions.cs b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SearchServiceClientExtensions.cs new file mode 100644 index 000000000000..77faeffde7e2 --- /dev/null +++ b/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Service/Generated/SearchServiceClientExtensions.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Search +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SearchServiceClient. + /// + public static partial class SearchServiceClientExtensions + { + /// + /// Gets service level statistics for an Azure Search service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Additional parameters for the operation + /// + public static ServiceStatistics GetServiceStatistics(this ISearchServiceClient operations, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions)) + { + return operations.GetServiceStatisticsAsync(searchRequestOptions).GetAwaiter().GetResult(); + } + + /// + /// Gets service level statistics for an Azure Search service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Additional parameters for the operation + /// + /// + /// The cancellation token. + /// + public static async Task GetServiceStatisticsAsync(this ISearchServiceClient operations, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetServiceStatisticsWithHttpMessagesAsync(searchRequestOptions, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/Search/DataPlane/Search.Tests/Search.Tests.csproj b/src/SDKs/Search/DataPlane/Search.Tests/Search.Tests.csproj index 2a8c462151ec..4707271e756e 100644 --- a/src/SDKs/Search/DataPlane/Search.Tests/Search.Tests.csproj +++ b/src/SDKs/Search/DataPlane/Search.Tests/Search.Tests.csproj @@ -26,4 +26,8 @@ + + + + \ No newline at end of file diff --git a/src/SDKs/Search/DataPlane/Search.Tests/SessionRecords/Microsoft.Azure.Search.Tests.ServiceStatsTests/GetServiceStatsReturnsCorrectDefinition.json b/src/SDKs/Search/DataPlane/Search.Tests/SessionRecords/Microsoft.Azure.Search.Tests.ServiceStatsTests/GetServiceStatsReturnsCorrectDefinition.json new file mode 100644 index 000000000000..e04033ccb0cb --- /dev/null +++ b/src/SDKs/Search/DataPlane/Search.Tests/SessionRecords/Microsoft.Azure.Search.Tests.ServiceStatsTests/GetServiceStatsReturnsCorrectDefinition.json @@ -0,0 +1,468 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/providers/Microsoft.Search/register?api-version=2016-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvM2M3MjliMmEtNGY4Ni00YmIyLWFiZTgtNGI4NjQ3YWYxNTZjL3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VhcmNoL3JlZ2lzdGVyP2FwaS12ZXJzaW9uPTIwMTYtMDktMDE=", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "678ce00a-0105-4dc5-a31f-e53d34157c08" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.5.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/providers/Microsoft.Search\",\r\n \"namespace\": \"Microsoft.Search\",\r\n \"authorization\": {\r\n \"applicationId\": \"408992c7-2af6-4ff1-92e3-65b73d2b5092\",\r\n \"roleDefinitionId\": \"20FA3191-87CF-4C3D-9510-74CCB594A310\",\r\n \"managedByRoleDefinitionId\": \"C1F73CCC-13F1-4BA3-BA60-A373C0A3EE0C\"\r\n },\r\n \"resourceTypes\": [\r\n {\r\n \"resourceType\": \"searchServices\",\r\n \"locations\": [\r\n \"West US\"\r\n ],\r\n \"apiVersions\": [\r\n \"2015-08-19\",\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ],\r\n \"capabilities\": \"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove\"\r\n },\r\n {\r\n \"resourceType\": \"searchServicesCit\",\r\n \"locations\": [\r\n \"West US\"\r\n ],\r\n \"apiVersions\": [\r\n \"2015-08-19\",\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ],\r\n \"capabilities\": \"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove\"\r\n },\r\n {\r\n \"resourceType\": \"searchServicesInt\",\r\n \"locations\": [\r\n \"West US\"\r\n ],\r\n \"apiVersions\": [\r\n \"2015-08-19\",\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ],\r\n \"capabilities\": \"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove\"\r\n },\r\n {\r\n \"resourceType\": \"searchServicesPpe\",\r\n \"locations\": [\r\n \"West US\"\r\n ],\r\n \"apiVersions\": [\r\n \"2015-08-19\",\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ],\r\n \"capabilities\": \"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove\"\r\n },\r\n {\r\n \"resourceType\": \"searchServicesEXP\",\r\n \"locations\": [\r\n \"East US 2\"\r\n ],\r\n \"apiVersions\": [\r\n \"2015-08-19\",\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ],\r\n \"capabilities\": \"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove\"\r\n },\r\n {\r\n \"resourceType\": \"checkServiceNameAvailability\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"checkServiceNameAvailabilityCit\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"checkServiceNameAvailabilityInt\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"checkServiceNameAvailabilityPpe\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"checkServiceNameAvailabilityEXP\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-02-28\",\r\n \"2014-07-31-Preview\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"checkNameAvailability\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-08-19\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"checkNameAvailabilityCit\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-08-19\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"checkNameAvailabilityInt\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-08-19\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"checkNameAvailabilityPpe\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-08-19\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"checkNameAvailabilityEXP\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-08-19\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"resourceHealthMetadata\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-08-19\"\r\n ]\r\n },\r\n {\r\n \"resourceType\": \"operations\",\r\n \"locations\": [],\r\n \"apiVersions\": [\r\n \"2015-08-19\",\r\n \"2015-02-28\"\r\n ]\r\n }\r\n ],\r\n \"registrationState\": \"Registered\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Apr 2018 17:52:21 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "2df39f27-2586-4fa2-a597-cf68f6c026b3" + ], + "x-ms-correlation-request-id": [ + "2df39f27-2586-4fa2-a597-cf68f6c026b3" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20180405T175221Z:2df39f27-2586-4fa2-a597-cf68f6c026b3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/resourcegroups/azsmnet5350?api-version=2016-09-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvM2M3MjliMmEtNGY4Ni00YmIyLWFiZTgtNGI4NjQ3YWYxNTZjL3Jlc291cmNlZ3JvdXBzL2F6c21uZXQ1MzUwP2FwaS12ZXJzaW9uPTIwMTYtMDktMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"West US\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "29" + ], + "x-ms-client-request-id": [ + "559f2ed0-62fb-433e-a065-9d86119f15a5" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.5.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/resourceGroups/azsmnet5350\",\r\n \"name\": \"azsmnet5350\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "175" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Apr 2018 17:52:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-request-id": [ + "966bad4e-92a4-429f-880a-d567b0d03cec" + ], + "x-ms-correlation-request-id": [ + "966bad4e-92a4-429f-880a-d567b0d03cec" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20180405T175223Z:966bad4e-92a4-429f-880a-d567b0d03cec" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/resourceGroups/azsmnet5350/providers/Microsoft.Search/searchServices/azs-5189?api-version=2015-08-19", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvM2M3MjliMmEtNGY4Ni00YmIyLWFiZTgtNGI4NjQ3YWYxNTZjL3Jlc291cmNlR3JvdXBzL2F6c21uZXQ1MzUwL3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VhcmNoL3NlYXJjaFNlcnZpY2VzL2F6cy01MTg5P2FwaS12ZXJzaW9uPTIwMTUtMDgtMTk=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"free\"\r\n },\r\n \"location\": \"West US\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "67" + ], + "x-ms-client-request-id": [ + "fa45a534-3953-4ff5-9c77-d473fa85ff9e" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Search.SearchManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/resourceGroups/azsmnet5350/providers/Microsoft.Search/searchServices/azs-5189\",\r\n \"name\": \"azs-5189\",\r\n \"type\": \"Microsoft.Search/searchServices\",\r\n \"location\": \"West US\",\r\n \"properties\": {\r\n \"replicaCount\": 1,\r\n \"partitionCount\": 1,\r\n \"status\": \"running\",\r\n \"statusDetails\": \"\",\r\n \"provisioningState\": \"succeeded\",\r\n \"hostingMode\": \"Default\"\r\n },\r\n \"sku\": {\r\n \"name\": \"free\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "385" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Apr 2018 17:52:31 GMT" + ], + "Pragma": [ + "no-cache" + ], + "ETag": [ + "W/\"datetime'2018-04-05T17%3A52%3A31.2072295Z'\"" + ], + "x-ms-request-id": [ + "fa45a534-3953-4ff5-9c77-d473fa85ff9e" + ], + "request-id": [ + "fa45a534-3953-4ff5-9c77-d473fa85ff9e" + ], + "elapsed-time": [ + "3390" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "4686ec4c-e67f-408b-a514-c86f5a2dbc0e" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20180405T175231Z:4686ec4c-e67f-408b-a514-c86f5a2dbc0e" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/resourceGroups/azsmnet5350/providers/Microsoft.Search/searchServices/azs-5189/listAdminKeys?api-version=2015-08-19", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvM2M3MjliMmEtNGY4Ni00YmIyLWFiZTgtNGI4NjQ3YWYxNTZjL3Jlc291cmNlR3JvdXBzL2F6c21uZXQ1MzUwL3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VhcmNoL3NlYXJjaFNlcnZpY2VzL2F6cy01MTg5L2xpc3RBZG1pbktleXM/YXBpLXZlcnNpb249MjAxNS0wOC0xOQ==", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "71bbde7b-2131-4f4f-8d53-e745699c7780" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Search.SearchManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"primaryKey\": \"150BE983903B78AE7D725B2329FC36EF\",\r\n \"secondaryKey\": \"FBCA81C0D292D7CB7325F648A7341AFE\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Apr 2018 17:52:33 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "71bbde7b-2131-4f4f-8d53-e745699c7780" + ], + "request-id": [ + "71bbde7b-2131-4f4f-8d53-e745699c7780" + ], + "elapsed-time": [ + "147" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1195" + ], + "x-ms-correlation-request-id": [ + "feb30dc1-6401-4621-993b-1b7aaaf7df14" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20180405T175233Z:feb30dc1-6401-4621-993b-1b7aaaf7df14" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/resourceGroups/azsmnet5350/providers/Microsoft.Search/searchServices/azs-5189/listQueryKeys?api-version=2015-08-19", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvM2M3MjliMmEtNGY4Ni00YmIyLWFiZTgtNGI4NjQ3YWYxNTZjL3Jlc291cmNlR3JvdXBzL2F6c21uZXQ1MzUwL3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VhcmNoL3NlYXJjaFNlcnZpY2VzL2F6cy01MTg5L2xpc3RRdWVyeUtleXM/YXBpLXZlcnNpb249MjAxNS0wOC0xOQ==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "610dd2cb-7af0-471a-b6b3-ad8e90759ec6" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Search.SearchManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"name\": null,\r\n \"key\": \"0FA62BECA61B6729B8C6CB81B8F02734\"\r\n }\r\n ],\r\n \"nextLink\": null\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Apr 2018 17:52:33 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "610dd2cb-7af0-471a-b6b3-ad8e90759ec6" + ], + "request-id": [ + "610dd2cb-7af0-471a-b6b3-ad8e90759ec6" + ], + "elapsed-time": [ + "125" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "9e954dbb-d973-4ad3-98e2-60d871c23ef2" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20180405T175234Z:9e954dbb-d973-4ad3-98e2-60d871c23ef2" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/servicestats?api-version=2016-09-01-Preview", + "EncodedRequestUri": "L3NlcnZpY2VzdGF0cz9hcGktdmVyc2lvbj0yMDE2LTA5LTAxLVByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "client-request-id": [ + "d484f603-f7bc-4b97-ad84-db22576a9fe6" + ], + "accept-language": [ + "en-US" + ], + "api-key": [ + "150BE983903B78AE7D725B2329FC36EF" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Search.SearchServiceClient/5.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"@odata.context\": \"https://azs-5189.search-dogfood.windows-int.net/$metadata#Microsoft.Azure.Search.V2016_09_01_Preview.ServiceStatistics\",\r\n \"counters\": {\r\n \"documentCount\": {\r\n \"usage\": 0,\r\n \"quota\": null\r\n },\r\n \"indexesCount\": {\r\n \"usage\": 0,\r\n \"quota\": 3\r\n },\r\n \"indexersCount\": {\r\n \"usage\": 0,\r\n \"quota\": 3\r\n },\r\n \"dataSourcesCount\": {\r\n \"usage\": 0,\r\n \"quota\": 3\r\n },\r\n \"storageSize\": {\r\n \"usage\": 0,\r\n \"quota\": 52428800\r\n },\r\n \"synonymMaps\": {\r\n \"usage\": 0,\r\n \"quota\": 3\r\n }\r\n },\r\n \"limits\": {\r\n \"maxFieldsPerIndex\": 1000,\r\n \"maxIndexerRunTime\": \"PT1M\",\r\n \"maxFileExtractionSize\": 16777216,\r\n \"maxFileContentCharactersToExtract\": 32768,\r\n \"maxFieldNestingDepthPerIndex\": 10,\r\n \"maxComplexCollectionFieldsPerIndex\": 100\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; odata.metadata=minimal; odata.streaming=true" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Apr 2018 17:52:35 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "request-id": [ + "d484f603-f7bc-4b97-ad84-db22576a9fe6" + ], + "elapsed-time": [ + "159" + ], + "OData-Version": [ + "4.0" + ], + "Preference-Applied": [ + "odata.include-annotations=\"*\"" + ], + "Strict-Transport-Security": [ + "max-age=15724800; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/3c729b2a-4f86-4bb2-abe8-4b8647af156c/resourceGroups/azsmnet5350/providers/Microsoft.Search/searchServices/azs-5189?api-version=2015-08-19", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvM2M3MjliMmEtNGY4Ni00YmIyLWFiZTgtNGI4NjQ3YWYxNTZjL3Jlc291cmNlR3JvdXBzL2F6c21uZXQ1MzUwL3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VhcmNoL3NlYXJjaFNlcnZpY2VzL2F6cy01MTg5P2FwaS12ZXJzaW9uPTIwMTUtMDgtMTk=", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "5247ac71-26c8-41df-bebc-31cfc167e07e" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.Search.SearchManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Apr 2018 17:52:40 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "5247ac71-26c8-41df-bebc-31cfc167e07e" + ], + "request-id": [ + "5247ac71-26c8-41df-bebc-31cfc167e07e" + ], + "elapsed-time": [ + "808" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "97ffe652-5d25-42b7-a288-b11046e978e5" + ], + "x-ms-routing-request-id": [ + "NORTHEUROPE:20180405T175240Z:97ffe652-5d25-42b7-a288-b11046e978e5" + ], + "X-Content-Type-Options": [ + "nosniff" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "GenerateName": [ + "azsmnet5350" + ], + "GenerateServiceName": [ + "azs-5189" + ] + }, + "Variables": { + "SubscriptionId": "3c729b2a-4f86-4bb2-abe8-4b8647af156c" + } +} \ No newline at end of file diff --git a/src/SDKs/Search/DataPlane/Search.Tests/Tests/ServiceStatsTests.cs b/src/SDKs/Search/DataPlane/Search.Tests/Tests/ServiceStatsTests.cs new file mode 100644 index 000000000000..2f07d9bdbb33 --- /dev/null +++ b/src/SDKs/Search/DataPlane/Search.Tests/Tests/ServiceStatsTests.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. + +namespace Microsoft.Azure.Search.Tests +{ + using Microsoft.Azure.Search.Models; + using Microsoft.Azure.Search.Tests.Utilities; + using System; + using Xunit; + + public sealed class ServiceStatsTests : SearchTestBase + { + [Fact] + public void GetServiceStatsReturnsCorrectDefinition() + { + Run(() => + { + SearchServiceClient searchClient = Data.GetSearchServiceClient(); + var expectedStats = new ServiceStatistics + { + Counters = new ServiceCounters + { + DocumentCounter = new ResourceCounter(0, null), + IndexCounter = new ResourceCounter(0, 3), + IndexerCounter = new ResourceCounter(0, 3), + DataSourceCounter = new ResourceCounter(0, 3), + StorageSizeCounter = new ResourceCounter(0, 52428800), + SynonymMapCounter = new ResourceCounter(0, 3) + }, + Limits = new ServiceLimits + { + MaxFieldsPerIndex = 1000, + MaxIndexerRunTime = TimeSpan.FromMinutes(1), + MaxFileExtractionSize = 16777216, + MaxFileContentCharactersToExtract = 32768, + MaxFieldNestingDepthPerIndex = 10, + MaxComplexCollectionFieldsPerIndex = 100 + } + }; + + ServiceStatistics stats = searchClient.GetServiceStatistics(); + Assert.Equal(expectedStats, stats, new ModelComparer()); + }); + } + } +} diff --git a/src/SDKs/_metadata/search_data-plane_Microsoft.Azure.Search.Service.txt b/src/SDKs/_metadata/search_data-plane_Microsoft.Azure.Search.Service.txt index d01e3437c826..2b2e3a946f1c 100644 --- a/src/SDKs/_metadata/search_data-plane_Microsoft.Azure.Search.Service.txt +++ b/src/SDKs/_metadata/search_data-plane_Microsoft.Azure.Search.Service.txt @@ -1,11 +1,11 @@ -2018-03-30 00:47:28 UTC +2018-04-05 17:48:08 UTC 1) azure-rest-api-specs repository information GitHub user: Azure Branch: master -Commit: 83c74ca7cc11fee3210ce40f042a522e3e209ae9 +Commit: 94df8612289968e9537dbd4a4023d692da9cefe1 2) AutoRest information Requested version: latest -Bootstrapper version: C:\Users\eugenesh\AppData\Roaming\npm `-- autorest@2.0.4245 +Bootstrapper version: C:\Users\natinimn\AppData\Roaming\npm `-- autorest@2.0.4262 Latest installed version: