From 38e5a176141d9b502be3b953226214fa889bb5b6 Mon Sep 17 00:00:00 2001 From: Matt <57731498+mattmsft@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:09:02 -0700 Subject: [PATCH] Update Microsoft.Search to include 2023-11-01 API version (#39326) * initial regeneration * update tests * update generated code * generated code feedback * updating recordings * fix tests * recording tests * recording tests * regenerate code * updating generated code * update * updating tests * update changelog * fixing changelog --------- Co-authored-by: Matt Gotteiner --- .../Azure.ResourceManager.Search/CHANGELOG.md | 13 ++ ...e.ResourceManager.Search.netstandard2.0.cs | 46 ++++- .../Azure.ResourceManager.Search/assets.json | 2 +- ...archPrivateEndpointConnectionCollection.cs | 10 +- ...SearchPrivateEndpointConnectionResource.cs | 6 +- .../Samples/Sample_SearchServiceCollection.cs | 69 +++++-- .../Samples/Sample_SearchServiceResource.cs | 75 +++++-- ..._SharedSearchServicePrivateLinkResource.cs | 6 +- ...rchServicePrivateLinkResourceCollection.cs | 10 +- .../Sample_SubscriptionResourceExtensions.cs | 77 ++++++++ .../src/Generated/ArmSearchModelFactory.cs | 31 ++- .../Generated/Extensions/SearchExtensions.cs | 100 ++++++++++ .../SubscriptionResourceExtensionClient.cs | 122 ++++++++++++ .../Models/QuotaUsageResult.Serialization.cs | 73 +++++++ .../src/Generated/Models/QuotaUsageResult.cs | 46 +++++ .../QuotaUsageResultName.Serialization.cs | 39 ++++ .../Generated/Models/QuotaUsageResultName.cs | 32 +++ .../QuotaUsagesListResult.Serialization.cs | 49 +++++ .../Generated/Models/QuotaUsagesListResult.cs | 36 ++++ .../Generated/Models/SearchSemanticSearch.cs | 54 +++++ .../Models/SearchServiceData.Serialization.cs | 25 ++- .../SearchServicePatch.Serialization.cs | 25 ++- .../Generated/Models/SearchServicePatch.cs | 6 +- .../RestOperations/AdminKeysRestOperations.cs | 2 +- ...rivateEndpointConnectionsRestOperations.cs | 2 +- .../PrivateLinkResourcesRestOperations.cs | 2 +- .../RestOperations/QueryKeysRestOperations.cs | 2 +- .../SearchManagementRestOperations.cs | 118 +++++++++++ .../RestOperations/ServicesRestOperations.cs | 2 +- ...haredPrivateLinkResourcesRestOperations.cs | 2 +- .../RestOperations/UsagesRestOperations.cs | 185 ++++++++++++++++++ .../src/Generated/SearchServiceData.cs | 6 +- .../src/autorest.md | 7 +- .../tests/SearchManagementTestBase.cs | 2 +- .../Tests/SearchServiceCollectionTests.cs | 16 +- .../tests/Tests/SearchServiceResourceTest.cs | 60 ++++-- 36 files changed, 1271 insertions(+), 87 deletions(-) create mode 100644 sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResult.Serialization.cs create mode 100644 sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResult.cs create mode 100644 sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResultName.Serialization.cs create mode 100644 sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResultName.cs create mode 100644 sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsagesListResult.Serialization.cs create mode 100644 sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsagesListResult.cs create mode 100644 sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchSemanticSearch.cs create mode 100644 sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/SearchManagementRestOperations.cs create mode 100644 sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/UsagesRestOperations.cs diff --git a/sdk/search/Azure.ResourceManager.Search/CHANGELOG.md b/sdk/search/Azure.ResourceManager.Search/CHANGELOG.md index adc5d933edb64..f1384805eccbc 100644 --- a/sdk/search/Azure.ResourceManager.Search/CHANGELOG.md +++ b/sdk/search/Azure.ResourceManager.Search/CHANGELOG.md @@ -10,6 +10,19 @@ ### Other Changes +## 1.2.0 (2023-11-01) + +### Features Added + +- Added support for '2023-11-01' management plane API version. +- Enable the [semantic search](https://learn.microsoft.com/azure/search/semantic-search-overview) feature + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.2.0-beta.1 (2023-05-31) ### Features Added diff --git a/sdk/search/Azure.ResourceManager.Search/api/Azure.ResourceManager.Search.netstandard2.0.cs b/sdk/search/Azure.ResourceManager.Search/api/Azure.ResourceManager.Search.netstandard2.0.cs index 7d94f9156cbc6..6191719a1d108 100644 --- a/sdk/search/Azure.ResourceManager.Search/api/Azure.ResourceManager.Search.netstandard2.0.cs +++ b/sdk/search/Azure.ResourceManager.Search/api/Azure.ResourceManager.Search.netstandard2.0.cs @@ -12,6 +12,10 @@ public static partial class SearchExtensions public static Azure.Pageable GetSearchServices(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetSearchServicesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Search.SharedSearchServicePrivateLinkResource GetSharedSearchServicePrivateLinkResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Pageable GetUsagesBySubscription(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetUsagesBySubscriptionAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response UsageBySubscriptionSku(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, string skuName, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> UsageBySubscriptionSkuAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, string skuName, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class SearchPrivateEndpointConnectionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -80,6 +84,7 @@ public SearchServiceData(Azure.Core.AzureLocation location) : base (default(Azur public Azure.ResourceManager.Search.Models.SearchServiceProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } public int? ReplicaCount { get { throw null; } set { } } + public Azure.ResourceManager.Search.Models.SearchSemanticSearch? SemanticSearch { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList SharedPrivateLinkResources { get { throw null; } } public Azure.ResourceManager.Search.Models.SearchSkuName? SkuName { get { throw null; } set { } } public Azure.ResourceManager.Search.Models.SearchServiceStatus? Status { get { throw null; } } @@ -164,19 +169,36 @@ namespace Azure.ResourceManager.Search.Models { public static partial class ArmSearchModelFactory { + public static Azure.ResourceManager.Search.Models.QuotaUsageResult QuotaUsageResult(Azure.Core.ResourceIdentifier id = null, string unit = null, int? currentValue = default(int?), int? limit = default(int?), Azure.ResourceManager.Search.Models.QuotaUsageResultName name = null) { throw null; } + public static Azure.ResourceManager.Search.Models.QuotaUsageResultName QuotaUsageResultName(string value = null, string localizedValue = null) { throw null; } public static Azure.ResourceManager.Search.Models.SearchEncryptionWithCmk SearchEncryptionWithCmk(Azure.ResourceManager.Search.Models.SearchEncryptionWithCmkEnforcement? enforcement = default(Azure.ResourceManager.Search.Models.SearchEncryptionWithCmkEnforcement?), Azure.ResourceManager.Search.Models.SearchEncryptionComplianceStatus? encryptionComplianceStatus = default(Azure.ResourceManager.Search.Models.SearchEncryptionComplianceStatus?)) { throw null; } public static Azure.ResourceManager.Search.SearchPrivateEndpointConnectionData SearchPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Search.Models.SearchServicePrivateEndpointConnectionProperties properties = null) { throw null; } public static Azure.ResourceManager.Search.Models.SearchPrivateLinkResource SearchPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Search.Models.SearchPrivateLinkResourceProperties properties = null) { throw null; } public static Azure.ResourceManager.Search.Models.SearchPrivateLinkResourceProperties SearchPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null, System.Collections.Generic.IEnumerable shareablePrivateLinkResourceTypes = null) { throw null; } public static Azure.ResourceManager.Search.Models.SearchServiceAdminKeyResult SearchServiceAdminKeyResult(string primaryKey = null, string secondaryKey = null) { throw null; } - public static Azure.ResourceManager.Search.SearchServiceData SearchServiceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Search.Models.SearchSkuName? skuName = default(Azure.ResourceManager.Search.Models.SearchSkuName?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, int? replicaCount = default(int?), int? partitionCount = default(int?), Azure.ResourceManager.Search.Models.SearchServiceHostingMode? hostingMode = default(Azure.ResourceManager.Search.Models.SearchServiceHostingMode?), Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess?), Azure.ResourceManager.Search.Models.SearchServiceStatus? status = default(Azure.ResourceManager.Search.Models.SearchServiceStatus?), string statusDetails = null, Azure.ResourceManager.Search.Models.SearchServiceProvisioningState? provisioningState = default(Azure.ResourceManager.Search.Models.SearchServiceProvisioningState?), System.Collections.Generic.IEnumerable ipRules = null, Azure.ResourceManager.Search.Models.SearchEncryptionWithCmk encryptionWithCmk = null, bool? isLocalAuthDisabled = default(bool?), Azure.ResourceManager.Search.Models.SearchAadAuthDataPlaneAuthOptions authOptions = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable sharedPrivateLinkResources = null) { throw null; } + public static Azure.ResourceManager.Search.SearchServiceData SearchServiceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Search.Models.SearchSkuName? skuName = default(Azure.ResourceManager.Search.Models.SearchSkuName?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, int? replicaCount = default(int?), int? partitionCount = default(int?), Azure.ResourceManager.Search.Models.SearchServiceHostingMode? hostingMode = default(Azure.ResourceManager.Search.Models.SearchServiceHostingMode?), Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess?), Azure.ResourceManager.Search.Models.SearchServiceStatus? status = default(Azure.ResourceManager.Search.Models.SearchServiceStatus?), string statusDetails = null, Azure.ResourceManager.Search.Models.SearchServiceProvisioningState? provisioningState = default(Azure.ResourceManager.Search.Models.SearchServiceProvisioningState?), System.Collections.Generic.IEnumerable ipRules = null, Azure.ResourceManager.Search.Models.SearchEncryptionWithCmk encryptionWithCmk = null, bool? isLocalAuthDisabled = default(bool?), Azure.ResourceManager.Search.Models.SearchAadAuthDataPlaneAuthOptions authOptions = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.Search.Models.SearchSemanticSearch? semanticSearch = default(Azure.ResourceManager.Search.Models.SearchSemanticSearch?), System.Collections.Generic.IEnumerable sharedPrivateLinkResources = null) { throw null; } public static Azure.ResourceManager.Search.Models.SearchServiceNameAvailabilityResult SearchServiceNameAvailabilityResult(bool? isNameAvailable = default(bool?), Azure.ResourceManager.Search.Models.SearchServiceNameUnavailableReason? reason = default(Azure.ResourceManager.Search.Models.SearchServiceNameUnavailableReason?), string message = null) { throw null; } - public static Azure.ResourceManager.Search.Models.SearchServicePatch SearchServicePatch(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Search.Models.SearchSkuName? skuName = default(Azure.ResourceManager.Search.Models.SearchSkuName?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, int? replicaCount = default(int?), int? partitionCount = default(int?), Azure.ResourceManager.Search.Models.SearchServiceHostingMode? hostingMode = default(Azure.ResourceManager.Search.Models.SearchServiceHostingMode?), Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess?), Azure.ResourceManager.Search.Models.SearchServiceStatus? status = default(Azure.ResourceManager.Search.Models.SearchServiceStatus?), string statusDetails = null, Azure.ResourceManager.Search.Models.SearchServiceProvisioningState? provisioningState = default(Azure.ResourceManager.Search.Models.SearchServiceProvisioningState?), System.Collections.Generic.IEnumerable ipRules = null, Azure.ResourceManager.Search.Models.SearchEncryptionWithCmk encryptionWithCmk = null, bool? isLocalAuthDisabled = default(bool?), Azure.ResourceManager.Search.Models.SearchAadAuthDataPlaneAuthOptions authOptions = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable sharedPrivateLinkResources = null) { throw null; } + public static Azure.ResourceManager.Search.Models.SearchServicePatch SearchServicePatch(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Search.Models.SearchSkuName? skuName = default(Azure.ResourceManager.Search.Models.SearchSkuName?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, int? replicaCount = default(int?), int? partitionCount = default(int?), Azure.ResourceManager.Search.Models.SearchServiceHostingMode? hostingMode = default(Azure.ResourceManager.Search.Models.SearchServiceHostingMode?), Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess?), Azure.ResourceManager.Search.Models.SearchServiceStatus? status = default(Azure.ResourceManager.Search.Models.SearchServiceStatus?), string statusDetails = null, Azure.ResourceManager.Search.Models.SearchServiceProvisioningState? provisioningState = default(Azure.ResourceManager.Search.Models.SearchServiceProvisioningState?), System.Collections.Generic.IEnumerable ipRules = null, Azure.ResourceManager.Search.Models.SearchEncryptionWithCmk encryptionWithCmk = null, bool? isLocalAuthDisabled = default(bool?), Azure.ResourceManager.Search.Models.SearchAadAuthDataPlaneAuthOptions authOptions = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.Search.Models.SearchSemanticSearch? semanticSearch = default(Azure.ResourceManager.Search.Models.SearchSemanticSearch?), System.Collections.Generic.IEnumerable sharedPrivateLinkResources = null) { throw null; } public static Azure.ResourceManager.Search.Models.SearchServiceQueryKey SearchServiceQueryKey(string name = null, string key = null) { throw null; } public static Azure.ResourceManager.Search.Models.ShareableSearchServicePrivateLinkResourceProperties ShareableSearchServicePrivateLinkResourceProperties(string shareablePrivateLinkResourcePropertiesType = null, string groupId = null, string description = null) { throw null; } public static Azure.ResourceManager.Search.Models.ShareableSearchServicePrivateLinkResourceType ShareableSearchServicePrivateLinkResourceType(string name = null, Azure.ResourceManager.Search.Models.ShareableSearchServicePrivateLinkResourceProperties properties = null) { throw null; } public static Azure.ResourceManager.Search.SharedSearchServicePrivateLinkResourceData SharedSearchServicePrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Search.Models.SharedSearchServicePrivateLinkResourceProperties properties = null) { throw null; } } + public partial class QuotaUsageResult + { + internal QuotaUsageResult() { } + public int? CurrentValue { get { throw null; } } + public Azure.Core.ResourceIdentifier Id { get { throw null; } } + public int? Limit { get { throw null; } } + public Azure.ResourceManager.Search.Models.QuotaUsageResultName Name { get { throw null; } } + public string Unit { get { throw null; } } + } + public partial class QuotaUsageResultName + { + internal QuotaUsageResultName() { } + public string LocalizedValue { get { throw null; } } + public string Value { get { throw null; } } + } public partial class SearchAadAuthDataPlaneAuthOptions { public SearchAadAuthDataPlaneAuthOptions() { } @@ -245,6 +267,25 @@ internal SearchPrivateLinkResourceProperties() { } public static bool operator !=(Azure.ResourceManager.Search.Models.SearchPrivateLinkServiceConnectionProvisioningState left, Azure.ResourceManager.Search.Models.SearchPrivateLinkServiceConnectionProvisioningState right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SearchSemanticSearch : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SearchSemanticSearch(string value) { throw null; } + public static Azure.ResourceManager.Search.Models.SearchSemanticSearch Disabled { get { throw null; } } + public static Azure.ResourceManager.Search.Models.SearchSemanticSearch Free { get { throw null; } } + public static Azure.ResourceManager.Search.Models.SearchSemanticSearch Standard { get { throw null; } } + public bool Equals(Azure.ResourceManager.Search.Models.SearchSemanticSearch other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Search.Models.SearchSemanticSearch left, Azure.ResourceManager.Search.Models.SearchSemanticSearch right) { throw null; } + public static implicit operator Azure.ResourceManager.Search.Models.SearchSemanticSearch (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Search.Models.SearchSemanticSearch left, Azure.ResourceManager.Search.Models.SearchSemanticSearch right) { throw null; } + public override string ToString() { throw null; } + } public enum SearchServiceAdminKeyKind { Primary = 0, @@ -311,6 +352,7 @@ public SearchServicePatch(Azure.Core.AzureLocation location) : base (default(Azu public Azure.ResourceManager.Search.Models.SearchServiceProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Search.Models.SearchServicePublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } public int? ReplicaCount { get { throw null; } set { } } + public Azure.ResourceManager.Search.Models.SearchSemanticSearch? SemanticSearch { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList SharedPrivateLinkResources { get { throw null; } } public Azure.ResourceManager.Search.Models.SearchSkuName? SkuName { get { throw null; } set { } } public Azure.ResourceManager.Search.Models.SearchServiceStatus? Status { get { throw null; } } diff --git a/sdk/search/Azure.ResourceManager.Search/assets.json b/sdk/search/Azure.ResourceManager.Search/assets.json index 230a2e152fe03..e9afe7202803d 100644 --- a/sdk/search/Azure.ResourceManager.Search/assets.json +++ b/sdk/search/Azure.ResourceManager.Search/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/search/Azure.ResourceManager.Search", - "Tag": "net/search/Azure.ResourceManager.Search_23f3eedd7c" + "Tag": "net/search/Azure.ResourceManager.Search_e536b506c0" } diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionCollection.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionCollection.cs index 24355c3486720..b5376d6d8f20a 100644 --- a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionCollection.cs +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_SearchPrivateEndpointConnectionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_PrivateEndpointConnectionUpdate() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/UpdatePrivateEndpointConnection.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/UpdatePrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -70,7 +70,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionUpdate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_PrivateEndpointConnectionGet() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetPrivateEndpointConnection.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -105,7 +105,7 @@ public async Task Get_PrivateEndpointConnectionGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_PrivateEndpointConnectionGet() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetPrivateEndpointConnection.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -136,7 +136,7 @@ public async Task Exists_PrivateEndpointConnectionGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_PrivateEndpointConnectionGet() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetPrivateEndpointConnection.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -179,7 +179,7 @@ public async Task GetIfExists_PrivateEndpointConnectionGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListPrivateEndpointConnectionsByService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/ListPrivateEndpointConnectionsByService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/ListPrivateEndpointConnectionsByService.json // this example is just showing the usage of "PrivateEndpointConnections_ListByService" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionResource.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionResource.cs index 1600582d88af5..9949ad455977b 100644 --- a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionResource.cs +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchPrivateEndpointConnectionResource.cs @@ -23,7 +23,7 @@ public partial class Sample_SearchPrivateEndpointConnectionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_PrivateEndpointConnectionUpdate() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/UpdatePrivateEndpointConnection.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/UpdatePrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -67,7 +67,7 @@ public async Task Update_PrivateEndpointConnectionUpdate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_PrivateEndpointConnectionGet() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetPrivateEndpointConnection.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -99,7 +99,7 @@ public async Task Get_PrivateEndpointConnectionGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_PrivateEndpointConnectionDelete() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/DeletePrivateEndpointConnection.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/DeletePrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceCollection.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceCollection.cs index 458d3ae822b3d..bd65ec38ee88d 100644 --- a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceCollection.cs +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceCollection.cs @@ -25,7 +25,7 @@ public partial class Sample_SearchServiceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_SearchCreateOrUpdateService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.json // this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -71,7 +71,7 @@ public async Task CreateOrUpdate_SearchCreateOrUpdateService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_SearchCreateOrUpdateServiceAuthOptions() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceAuthOptions.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceAuthOptions.json // this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -121,7 +121,7 @@ public async Task CreateOrUpdate_SearchCreateOrUpdateServiceAuthOptions() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_SearchCreateOrUpdateServiceDisableLocalAuth() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json // this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -168,7 +168,7 @@ public async Task CreateOrUpdate_SearchCreateOrUpdateServiceDisableLocalAuth() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json // this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -215,7 +215,7 @@ public async Task CreateOrUpdate_SearchCreateOrUpdateServiceToAllowAccessFromPri [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json // this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -271,7 +271,7 @@ public async Task CreateOrUpdate_SearchCreateOrUpdateServiceToAllowAccessFromPub [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_SearchCreateOrUpdateServiceWithCmkEnforcement() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json // this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -321,7 +321,7 @@ public async Task CreateOrUpdate_SearchCreateOrUpdateServiceWithCmkEnforcement() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_SearchCreateOrUpdateServiceWithIdentity() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceWithIdentity.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithIdentity.json // this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -363,12 +363,59 @@ public async Task CreateOrUpdate_SearchCreateOrUpdateServiceWithIdentity() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + // SearchCreateOrUpdateWithSemanticSearch + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_SearchCreateOrUpdateWithSemanticSearch() + { + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateWithSemanticSearch.json + // this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SearchServiceResource + SearchServiceCollection collection = resourceGroupResource.GetSearchServices(); + + // invoke the operation + string searchServiceName = "mysearchservice"; + SearchServiceData data = new SearchServiceData(new AzureLocation("westus")) + { + SkuName = SearchSkuName.Standard, + ReplicaCount = 3, + PartitionCount = 1, + HostingMode = SearchServiceHostingMode.Default, + SemanticSearch = SearchSemanticSearch.Free, + Tags = +{ +["app-name"] = "My e-commerce app", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data); + SearchServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SearchServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // SearchGetService [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_SearchGetService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchGetService.json // this example is just showing the usage of "Services_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -402,7 +449,7 @@ public async Task Get_SearchGetService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_SearchGetService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchGetService.json // this example is just showing the usage of "Services_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -432,7 +479,7 @@ public async Task Exists_SearchGetService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_SearchGetService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchGetService.json // this example is just showing the usage of "Services_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -474,7 +521,7 @@ public async Task GetIfExists_SearchGetService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_SearchListServicesByResourceGroup() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchListServicesByResourceGroup.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchListServicesByResourceGroup.json // this example is just showing the usage of "Services_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceResource.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceResource.cs index 405c12b6dff8e..06d0c05058d28 100644 --- a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceResource.cs +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SearchServiceResource.cs @@ -25,7 +25,7 @@ public partial class Sample_SearchServiceResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAdminKey_SearchGetAdminKeys() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetAdminKeys.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchGetAdminKeys.json // this example is just showing the usage of "AdminKeys_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task GetAdminKey_SearchGetAdminKeys() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegenerateAdminKey_SearchRegenerateAdminKey() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchRegenerateAdminKey.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchRegenerateAdminKey.json // this example is just showing the usage of "AdminKeys_Regenerate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -80,7 +80,7 @@ public async Task RegenerateAdminKey_SearchRegenerateAdminKey() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateQueryKey_SearchCreateQueryKey() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateQueryKey.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateQueryKey.json // this example is just showing the usage of "QueryKeys_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -108,7 +108,7 @@ public async Task CreateQueryKey_SearchCreateQueryKey() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetQueryKeysBySearchService_SearchListQueryKeysBySearchService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchListQueryKeysBySearchService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchListQueryKeysBySearchService.json // this example is just showing the usage of "QueryKeys_ListBySearchService" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -138,7 +138,7 @@ public async Task GetQueryKeysBySearchService_SearchListQueryKeysBySearchService [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteQueryKey_SearchDeleteQueryKey() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchDeleteQueryKey.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchDeleteQueryKey.json // this example is just showing the usage of "QueryKeys_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -166,7 +166,7 @@ public async Task DeleteQueryKey_SearchDeleteQueryKey() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_SearchUpdateService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateService.json // this example is just showing the usage of "Services_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -206,7 +206,7 @@ public async Task Update_SearchUpdateService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_SearchUpdateServiceAuthOptions() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceAuthOptions.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceAuthOptions.json // this example is just showing the usage of "Services_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -250,7 +250,7 @@ public async Task Update_SearchUpdateServiceAuthOptions() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_SearchUpdateServiceDisableLocalAuth() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceDisableLocalAuth.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceDisableLocalAuth.json // this example is just showing the usage of "Services_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -291,7 +291,7 @@ public async Task Update_SearchUpdateServiceDisableLocalAuth() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_SearchUpdateServiceToAllowAccessFromPrivateEndpoints() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json // this example is just showing the usage of "Services_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -328,7 +328,7 @@ public async Task Update_SearchUpdateServiceToAllowAccessFromPrivateEndpoints() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_SearchUpdateServiceToAllowAccessFromPublicCustomIPs() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json // this example is just showing the usage of "Services_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -375,7 +375,7 @@ public async Task Update_SearchUpdateServiceToAllowAccessFromPublicCustomIPs() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_SearchUpdateServiceToRemoveIdentity() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToRemoveIdentity.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToRemoveIdentity.json // this example is just showing the usage of "Services_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -411,7 +411,7 @@ public async Task Update_SearchUpdateServiceToRemoveIdentity() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_SearchUpdateServiceWithCmkEnforcement() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceWithCmkEnforcement.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithCmkEnforcement.json // this example is just showing the usage of "Services_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -450,12 +450,53 @@ public async Task Update_SearchUpdateServiceWithCmkEnforcement() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + // SearchUpdateServiceWithSemanticSearch + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_SearchUpdateServiceWithSemanticSearch() + { + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithSemanticSearch.json + // this example is just showing the usage of "Services_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SearchServiceResource created on azure + // for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string searchServiceName = "mysearchservice"; + ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName); + SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId); + + // invoke the operation + SearchServicePatch patch = new SearchServicePatch(new AzureLocation("placeholder")) + { + ReplicaCount = 2, + SemanticSearch = SearchSemanticSearch.Standard, + Tags = +{ +["app-name"] = "My e-commerce app", +["new-tag"] = "Adding a new tag", +}, + }; + SearchServiceResource result = await searchService.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SearchServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // SearchGetService [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_SearchGetService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchGetService.json // this example is just showing the usage of "Services_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -486,7 +527,7 @@ public async Task Get_SearchGetService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_SearchDeleteService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchDeleteService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchDeleteService.json // this example is just showing the usage of "Services_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -513,7 +554,7 @@ public async Task Delete_SearchDeleteService() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSearchServices_SearchListServicesBySubscription() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchListServicesBySubscription.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchListServicesBySubscription.json // this example is just showing the usage of "Services_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -545,7 +586,7 @@ public async Task GetSearchServices_SearchListServicesBySubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckSearchServiceNameAvailability_SearchCheckNameAvailability() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCheckNameAvailability.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCheckNameAvailability.json // this example is just showing the usage of "Services_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -571,7 +612,7 @@ public async Task CheckSearchServiceNameAvailability_SearchCheckNameAvailability [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSupportedPrivateLinkResources_ListSupportedPrivateLinkResources() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/ListSupportedPrivateLinkResources.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/ListSupportedPrivateLinkResources.json // this example is just showing the usage of "PrivateLinkResources_ListSupported" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResource.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResource.cs index 01a7c2aba6df1..a171536430b41 100644 --- a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResource.cs +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResource.cs @@ -23,7 +23,7 @@ public partial class Sample_SharedSearchServicePrivateLinkResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_SharedPrivateLinkResourceCreateOrUpdate() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/CreateOrUpdateSharedPrivateLinkResource.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/CreateOrUpdateSharedPrivateLinkResource.json // this example is just showing the usage of "SharedPrivateLinkResources_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -66,7 +66,7 @@ public async Task Update_SharedPrivateLinkResourceCreateOrUpdate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_SharedPrivateLinkResourceGet() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetSharedPrivateLinkResource.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetSharedPrivateLinkResource.json // this example is just showing the usage of "SharedPrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -98,7 +98,7 @@ public async Task Get_SharedPrivateLinkResourceGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_SharedPrivateLinkResourceDelete() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/DeleteSharedPrivateLinkResource.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/DeleteSharedPrivateLinkResource.json // this example is just showing the usage of "SharedPrivateLinkResources_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResourceCollection.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResourceCollection.cs index b2faff876621d..14e768422dbc0 100644 --- a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResourceCollection.cs +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SharedSearchServicePrivateLinkResourceCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_SharedSearchServicePrivateLinkResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_SharedPrivateLinkResourceCreateOrUpdate() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/CreateOrUpdateSharedPrivateLinkResource.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/CreateOrUpdateSharedPrivateLinkResource.json // this example is just showing the usage of "SharedPrivateLinkResources_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -69,7 +69,7 @@ public async Task CreateOrUpdate_SharedPrivateLinkResourceCreateOrUpdate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_SharedPrivateLinkResourceGet() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetSharedPrivateLinkResource.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetSharedPrivateLinkResource.json // this example is just showing the usage of "SharedPrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -104,7 +104,7 @@ public async Task Get_SharedPrivateLinkResourceGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_SharedPrivateLinkResourceGet() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetSharedPrivateLinkResource.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetSharedPrivateLinkResource.json // this example is just showing the usage of "SharedPrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -135,7 +135,7 @@ public async Task Exists_SharedPrivateLinkResourceGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_SharedPrivateLinkResourceGet() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetSharedPrivateLinkResource.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetSharedPrivateLinkResource.json // this example is just showing the usage of "SharedPrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -178,7 +178,7 @@ public async Task GetIfExists_SharedPrivateLinkResourceGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListSharedPrivateLinkResourcesByService() { - // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/ListSharedPrivateLinkResourcesByService.json + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/ListSharedPrivateLinkResourcesByService.json // this example is just showing the usage of "SharedPrivateLinkResources_ListByService" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 0000000000000..b2d78c6de427d --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Search; +using Azure.ResourceManager.Search.Models; + +namespace Azure.ResourceManager.Search.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + // GetQuotaUsagesList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsagesBySubscription_GetQuotaUsagesList() + { + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetQuotaUsagesList.json + // this example is just showing the usage of "Usages_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + AzureLocation location = new AzureLocation("westus"); + await foreach (QuotaUsageResult item in subscriptionResource.GetUsagesBySubscriptionAsync(location)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetQuotaUsage + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UsageBySubscriptionSku_GetQuotaUsage() + { + // Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetQuotaUsage.json + // this example is just showing the usage of "UsageBySubscriptionSku" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + string skuName = "free"; + QuotaUsageResult result = await subscriptionResource.UsageBySubscriptionSkuAsync(location, skuName); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/ArmSearchModelFactory.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/ArmSearchModelFactory.cs index a0a56b531a7e9..5fd270315dee8 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/ArmSearchModelFactory.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/ArmSearchModelFactory.cs @@ -56,16 +56,17 @@ public static SearchServiceQueryKey SearchServiceQueryKey(string name = null, st /// When set to true, calls to the search service will not be permitted to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' are defined. /// Defines the options for how the data plane API of a search service authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. /// The list of private endpoint connections to the Azure Cognitive Search service. + /// Sets options that control the availability of semantic search. This configuration is only possible for certain Azure Cognitive Search SKUs in certain locations. /// The list of shared private link resources managed by the Azure Cognitive Search service. /// A new instance for mocking. - public static SearchServiceData SearchServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SearchSkuName? skuName = null, ManagedServiceIdentity identity = null, int? replicaCount = null, int? partitionCount = null, SearchServiceHostingMode? hostingMode = null, SearchServicePublicNetworkAccess? publicNetworkAccess = null, SearchServiceStatus? status = null, string statusDetails = null, SearchServiceProvisioningState? provisioningState = null, IEnumerable ipRules = null, SearchEncryptionWithCmk encryptionWithCmk = null, bool? isLocalAuthDisabled = null, SearchAadAuthDataPlaneAuthOptions authOptions = null, IEnumerable privateEndpointConnections = null, IEnumerable sharedPrivateLinkResources = null) + public static SearchServiceData SearchServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SearchSkuName? skuName = null, ManagedServiceIdentity identity = null, int? replicaCount = null, int? partitionCount = null, SearchServiceHostingMode? hostingMode = null, SearchServicePublicNetworkAccess? publicNetworkAccess = null, SearchServiceStatus? status = null, string statusDetails = null, SearchServiceProvisioningState? provisioningState = null, IEnumerable ipRules = null, SearchEncryptionWithCmk encryptionWithCmk = null, bool? isLocalAuthDisabled = null, SearchAadAuthDataPlaneAuthOptions authOptions = null, IEnumerable privateEndpointConnections = null, SearchSemanticSearch? semanticSearch = null, IEnumerable sharedPrivateLinkResources = null) { tags ??= new Dictionary(); ipRules ??= new List(); privateEndpointConnections ??= new List(); sharedPrivateLinkResources ??= new List(); - return new SearchServiceData(id, name, resourceType, systemData, tags, location, skuName != null ? new SearchSku(skuName) : null, identity, replicaCount, partitionCount, hostingMode, publicNetworkAccess, status, statusDetails, provisioningState, ipRules != null ? new NetworkRuleSet(ipRules?.ToList()) : null, encryptionWithCmk, isLocalAuthDisabled, authOptions, privateEndpointConnections?.ToList(), sharedPrivateLinkResources?.ToList()); + return new SearchServiceData(id, name, resourceType, systemData, tags, location, skuName != null ? new SearchSku(skuName) : null, identity, replicaCount, partitionCount, hostingMode, publicNetworkAccess, status, statusDetails, provisioningState, ipRules != null ? new NetworkRuleSet(ipRules?.ToList()) : null, encryptionWithCmk, isLocalAuthDisabled, authOptions, privateEndpointConnections?.ToList(), semanticSearch, sharedPrivateLinkResources?.ToList()); } /// Initializes a new instance of SearchEncryptionWithCmk. @@ -122,16 +123,17 @@ public static SharedSearchServicePrivateLinkResourceData SharedSearchServicePriv /// When set to true, calls to the search service will not be permitted to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' are defined. /// Defines the options for how the data plane API of a search service authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. /// The list of private endpoint connections to the Azure Cognitive Search service. + /// Sets options that control the availability of semantic search. This configuration is only possible for certain Azure Cognitive Search SKUs in certain locations. /// The list of shared private link resources managed by the Azure Cognitive Search service. /// A new instance for mocking. - public static SearchServicePatch SearchServicePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SearchSkuName? skuName = null, ManagedServiceIdentity identity = null, int? replicaCount = null, int? partitionCount = null, SearchServiceHostingMode? hostingMode = null, SearchServicePublicNetworkAccess? publicNetworkAccess = null, SearchServiceStatus? status = null, string statusDetails = null, SearchServiceProvisioningState? provisioningState = null, IEnumerable ipRules = null, SearchEncryptionWithCmk encryptionWithCmk = null, bool? isLocalAuthDisabled = null, SearchAadAuthDataPlaneAuthOptions authOptions = null, IEnumerable privateEndpointConnections = null, IEnumerable sharedPrivateLinkResources = null) + public static SearchServicePatch SearchServicePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SearchSkuName? skuName = null, ManagedServiceIdentity identity = null, int? replicaCount = null, int? partitionCount = null, SearchServiceHostingMode? hostingMode = null, SearchServicePublicNetworkAccess? publicNetworkAccess = null, SearchServiceStatus? status = null, string statusDetails = null, SearchServiceProvisioningState? provisioningState = null, IEnumerable ipRules = null, SearchEncryptionWithCmk encryptionWithCmk = null, bool? isLocalAuthDisabled = null, SearchAadAuthDataPlaneAuthOptions authOptions = null, IEnumerable privateEndpointConnections = null, SearchSemanticSearch? semanticSearch = null, IEnumerable sharedPrivateLinkResources = null) { tags ??= new Dictionary(); ipRules ??= new List(); privateEndpointConnections ??= new List(); sharedPrivateLinkResources ??= new List(); - return new SearchServicePatch(id, name, resourceType, systemData, tags, location, skuName != null ? new SearchSku(skuName) : null, identity, replicaCount, partitionCount, hostingMode, publicNetworkAccess, status, statusDetails, provisioningState, ipRules != null ? new NetworkRuleSet(ipRules?.ToList()) : null, encryptionWithCmk, isLocalAuthDisabled, authOptions, privateEndpointConnections?.ToList(), sharedPrivateLinkResources?.ToList()); + return new SearchServicePatch(id, name, resourceType, systemData, tags, location, skuName != null ? new SearchSku(skuName) : null, identity, replicaCount, partitionCount, hostingMode, publicNetworkAccess, status, statusDetails, provisioningState, ipRules != null ? new NetworkRuleSet(ipRules?.ToList()) : null, encryptionWithCmk, isLocalAuthDisabled, authOptions, privateEndpointConnections?.ToList(), semanticSearch, sharedPrivateLinkResources?.ToList()); } /// Initializes a new instance of SearchPrivateLinkResource. @@ -189,5 +191,26 @@ public static SearchServiceNameAvailabilityResult SearchServiceNameAvailabilityR { return new SearchServiceNameAvailabilityResult(isNameAvailable, reason, message); } + + /// Initializes a new instance of QuotaUsageResult. + /// The resource id of the quota usage sku endpoint for Microsoft.Search provider. + /// The unit of measurement for the search sku. + /// The currently used up value for the particular search sku. + /// The quota limit for the particular search sku. + /// The name of the sku supported by Azure Cognitive Search. + /// A new instance for mocking. + public static QuotaUsageResult QuotaUsageResult(ResourceIdentifier id = null, string unit = null, int? currentValue = null, int? limit = null, QuotaUsageResultName name = null) + { + return new QuotaUsageResult(id, unit, currentValue, limit, name); + } + + /// Initializes a new instance of QuotaUsageResultName. + /// The sku name supported by Azure Cognitive Search. + /// The localized string value for the sku supported by Azure Cognitive Search. + /// A new instance for mocking. + public static QuotaUsageResultName QuotaUsageResultName(string value = null, string localizedValue = null) + { + return new QuotaUsageResultName(value, localizedValue); + } } } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SearchExtensions.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SearchExtensions.cs index 9c06291ee78a4..dc8a7e8de7385 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SearchExtensions.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SearchExtensions.cs @@ -258,5 +258,105 @@ public static Response CheckSearchServiceNa return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSearchServiceNameAvailability(content, searchManagementRequestOptions, cancellationToken); } + + /// + /// Gets a list of all Search quota usages in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetUsagesBySubscriptionAsync(this SubscriptionResource subscriptionResource, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesBySubscriptionAsync(location, searchManagementRequestOptions, cancellationToken); + } + + /// + /// Gets a list of all Search quota usages in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetUsagesBySubscription(this SubscriptionResource subscriptionResource, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesBySubscription(location, searchManagementRequestOptions, cancellationToken); + } + + /// + /// Gets the quota usage for a search sku in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName} + /// + /// + /// Operation Id + /// UsageBySubscriptionSku + /// + /// + /// + /// The instance the method will execute against. + /// The unique location name for a Microsoft Azure geographic region. + /// The unique search service sku name supported by Azure Cognitive Search. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public static async Task> UsageBySubscriptionSkuAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + return await GetSubscriptionResourceExtensionClient(subscriptionResource).UsageBySubscriptionSkuAsync(location, skuName, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the quota usage for a search sku in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName} + /// + /// + /// Operation Id + /// UsageBySubscriptionSku + /// + /// + /// + /// The instance the method will execute against. + /// The unique location name for a Microsoft Azure geographic region. + /// The unique search service sku name supported by Azure Cognitive Search. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public static Response UsageBySubscriptionSku(this SubscriptionResource subscriptionResource, AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + return GetSubscriptionResourceExtensionClient(subscriptionResource).UsageBySubscriptionSku(location, skuName, searchManagementRequestOptions, cancellationToken); + } } } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 8c089073768af..80ca75afdcedf 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -22,6 +22,10 @@ internal partial class SubscriptionResourceExtensionClient : ArmResource { private ClientDiagnostics _searchServiceServicesClientDiagnostics; private ServicesRestOperations _searchServiceServicesRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private SearchManagementRestOperations _defaultRestClient; /// Initializes a new instance of the class for mocking. protected SubscriptionResourceExtensionClient() @@ -37,6 +41,10 @@ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifie private ClientDiagnostics SearchServiceServicesClientDiagnostics => _searchServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Search", SearchServiceResource.ResourceType.Namespace, Diagnostics); private ServicesRestOperations SearchServiceServicesRestClient => _searchServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SearchServiceResource.ResourceType)); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Search", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Search", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SearchManagementRestOperations DefaultRestClient => _defaultRestClient ??= new SearchManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -153,5 +161,119 @@ public virtual Response CheckSearchServiceN throw; } } + + /// + /// Gets a list of all Search quota usages in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListBySubscription + /// + /// + /// + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesBySubscriptionAsync(AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, location, searchManagementRequestOptions); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, location, searchManagementRequestOptions); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, QuotaUsageResult.DeserializeQuotaUsageResult, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all Search quota usages in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListBySubscription + /// + /// + /// + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsagesBySubscription(AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, location, searchManagementRequestOptions); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, location, searchManagementRequestOptions); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, QuotaUsageResult.DeserializeQuotaUsageResult, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the quota usage for a search sku in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName} + /// + /// + /// Operation Id + /// UsageBySubscriptionSku + /// + /// + /// + /// The unique location name for a Microsoft Azure geographic region. + /// The unique search service sku name supported by Azure Cognitive Search. + /// Parameter group. + /// The cancellation token to use. + public virtual async Task> UsageBySubscriptionSkuAsync(AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.UsageBySubscriptionSku"); + scope.Start(); + try + { + var response = await DefaultRestClient.UsageBySubscriptionSkuAsync(Id.SubscriptionId, location, skuName, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the quota usage for a search sku in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName} + /// + /// + /// Operation Id + /// UsageBySubscriptionSku + /// + /// + /// + /// The unique location name for a Microsoft Azure geographic region. + /// The unique search service sku name supported by Azure Cognitive Search. + /// Parameter group. + /// The cancellation token to use. + public virtual Response UsageBySubscriptionSku(AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.UsageBySubscriptionSku"); + scope.Start(); + try + { + var response = DefaultRestClient.UsageBySubscriptionSku(Id.SubscriptionId, location, skuName, searchManagementRequestOptions, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResult.Serialization.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResult.Serialization.cs new file mode 100644 index 0000000000000..9a5a0a4e97655 --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResult.Serialization.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Search.Models +{ + public partial class QuotaUsageResult + { + internal static QuotaUsageResult DeserializeQuotaUsageResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional unit = default; + Optional currentValue = default; + Optional limit = default; + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (property.NameEquals("currentValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + currentValue = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("limit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + limit = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = QuotaUsageResultName.DeserializeQuotaUsageResultName(property.Value); + continue; + } + } + return new QuotaUsageResult(id.Value, unit.Value, Optional.ToNullable(currentValue), Optional.ToNullable(limit), name.Value); + } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResult.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResult.cs new file mode 100644 index 0000000000000..36b92e35bcf48 --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResult.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.Search.Models +{ + /// Describes the quota usage for a particular sku supported by Azure Cognitive Search. + public partial class QuotaUsageResult + { + /// Initializes a new instance of QuotaUsageResult. + internal QuotaUsageResult() + { + } + + /// Initializes a new instance of QuotaUsageResult. + /// The resource id of the quota usage sku endpoint for Microsoft.Search provider. + /// The unit of measurement for the search sku. + /// The currently used up value for the particular search sku. + /// The quota limit for the particular search sku. + /// The name of the sku supported by Azure Cognitive Search. + internal QuotaUsageResult(ResourceIdentifier id, string unit, int? currentValue, int? limit, QuotaUsageResultName name) + { + Id = id; + Unit = unit; + CurrentValue = currentValue; + Limit = limit; + Name = name; + } + + /// The resource id of the quota usage sku endpoint for Microsoft.Search provider. + public ResourceIdentifier Id { get; } + /// The unit of measurement for the search sku. + public string Unit { get; } + /// The currently used up value for the particular search sku. + public int? CurrentValue { get; } + /// The quota limit for the particular search sku. + public int? Limit { get; } + /// The name of the sku supported by Azure Cognitive Search. + public QuotaUsageResultName Name { get; } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResultName.Serialization.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResultName.Serialization.cs new file mode 100644 index 0000000000000..adb76c308aff5 --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResultName.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Search.Models +{ + public partial class QuotaUsageResultName + { + internal static QuotaUsageResultName DeserializeQuotaUsageResultName(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + Optional localizedValue = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("localizedValue"u8)) + { + localizedValue = property.Value.GetString(); + continue; + } + } + return new QuotaUsageResultName(value.Value, localizedValue.Value); + } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResultName.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResultName.cs new file mode 100644 index 0000000000000..3db9c9fe69147 --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsageResultName.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Search.Models +{ + /// The name of the sku supported by Azure Cognitive Search. + public partial class QuotaUsageResultName + { + /// Initializes a new instance of QuotaUsageResultName. + internal QuotaUsageResultName() + { + } + + /// Initializes a new instance of QuotaUsageResultName. + /// The sku name supported by Azure Cognitive Search. + /// The localized string value for the sku supported by Azure Cognitive Search. + internal QuotaUsageResultName(string value, string localizedValue) + { + Value = value; + LocalizedValue = localizedValue; + } + + /// The sku name supported by Azure Cognitive Search. + public string Value { get; } + /// The localized string value for the sku supported by Azure Cognitive Search. + public string LocalizedValue { get; } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsagesListResult.Serialization.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsagesListResult.Serialization.cs new file mode 100644 index 0000000000000..f570611f380bf --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsagesListResult.Serialization.cs @@ -0,0 +1,49 @@ +// 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.ResourceManager.Search.Models +{ + internal partial class QuotaUsagesListResult + { + internal static QuotaUsagesListResult DeserializeQuotaUsagesListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(QuotaUsageResult.DeserializeQuotaUsageResult(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new QuotaUsagesListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsagesListResult.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsagesListResult.cs new file mode 100644 index 0000000000000..efb58a476de6e --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/QuotaUsagesListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Search.Models +{ + /// Response containing the quota usage information for all the supported skus of Azure Cognitive Search service. + internal partial class QuotaUsagesListResult + { + /// Initializes a new instance of QuotaUsagesListResult. + internal QuotaUsagesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of QuotaUsagesListResult. + /// The quota usages for the SKUs supported by Azure Cognitive Search. + /// Request URL that can be used to query next page of quota usages. Returned when the total number of requested quota usages exceed maximum page size. + internal QuotaUsagesListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The quota usages for the SKUs supported by Azure Cognitive Search. + public IReadOnlyList Value { get; } + /// Request URL that can be used to query next page of quota usages. Returned when the total number of requested quota usages exceed maximum page size. + public string NextLink { get; } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchSemanticSearch.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchSemanticSearch.cs new file mode 100644 index 0000000000000..b058d72c5ee08 --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchSemanticSearch.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Search.Models +{ + /// Sets options that control the availability of semantic search. This configuration is only possible for certain Azure Cognitive Search SKUs in certain locations. + public readonly partial struct SearchSemanticSearch : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SearchSemanticSearch(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "disabled"; + private const string FreeValue = "free"; + private const string StandardValue = "standard"; + + /// Indicates that semantic search is disabled for the search service. + public static SearchSemanticSearch Disabled { get; } = new SearchSemanticSearch(DisabledValue); + /// Enables semantic search on a search service and indicates that it is to be used within the limits of the free tier. This would cap the volume of semantic search requests and is offered at no extra charge. This is the default for newly provisioned search services. + public static SearchSemanticSearch Free { get; } = new SearchSemanticSearch(FreeValue); + /// Enables semantic search on a search service as a billable feature, with higher throughput and volume of semantic search queries. + public static SearchSemanticSearch Standard { get; } = new SearchSemanticSearch(StandardValue); + /// Determines if two values are the same. + public static bool operator ==(SearchSemanticSearch left, SearchSemanticSearch right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SearchSemanticSearch left, SearchSemanticSearch right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SearchSemanticSearch(string value) => new SearchSemanticSearch(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SearchSemanticSearch other && Equals(other); + /// + public bool Equals(SearchSemanticSearch other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServiceData.Serialization.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServiceData.Serialization.cs index cf6199d2e8fb7..0924218c49953 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServiceData.Serialization.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServiceData.Serialization.cs @@ -90,6 +90,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("authOptions"u8); writer.WriteObjectValue(AuthOptions); } + if (Optional.IsDefined(SemanticSearch)) + { + if (SemanticSearch != null) + { + writer.WritePropertyName("semanticSearch"u8); + writer.WriteStringValue(SemanticSearch.Value.ToString()); + } + else + { + writer.WriteNull("semanticSearch"); + } + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -120,6 +132,7 @@ internal static SearchServiceData DeserializeSearchServiceData(JsonElement eleme Optional disableLocalAuth = default; Optional authOptions = default; Optional> privateEndpointConnections = default; + Optional semanticSearch = default; Optional> sharedPrivateLinkResources = default; foreach (var property in element.EnumerateObject()) { @@ -303,6 +316,16 @@ internal static SearchServiceData DeserializeSearchServiceData(JsonElement eleme privateEndpointConnections = array; continue; } + if (property0.NameEquals("semanticSearch"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + semanticSearch = null; + continue; + } + semanticSearch = new SearchSemanticSearch(property0.Value.GetString()); + continue; + } if (property0.NameEquals("sharedPrivateLinkResources"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -321,7 +344,7 @@ internal static SearchServiceData DeserializeSearchServiceData(JsonElement eleme continue; } } - return new SearchServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, identity, Optional.ToNullable(replicaCount), Optional.ToNullable(partitionCount), Optional.ToNullable(hostingMode), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(status), statusDetails.Value, Optional.ToNullable(provisioningState), networkRuleSet.Value, encryptionWithCmk.Value, Optional.ToNullable(disableLocalAuth), authOptions.Value, Optional.ToList(privateEndpointConnections), Optional.ToList(sharedPrivateLinkResources)); + return new SearchServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, identity, Optional.ToNullable(replicaCount), Optional.ToNullable(partitionCount), Optional.ToNullable(hostingMode), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(status), statusDetails.Value, Optional.ToNullable(provisioningState), networkRuleSet.Value, encryptionWithCmk.Value, Optional.ToNullable(disableLocalAuth), authOptions.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(semanticSearch), Optional.ToList(sharedPrivateLinkResources)); } } } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServicePatch.Serialization.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServicePatch.Serialization.cs index b9006c1f66037..8bd1f07d82c64 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServicePatch.Serialization.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServicePatch.Serialization.cs @@ -90,6 +90,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("authOptions"u8); writer.WriteObjectValue(AuthOptions); } + if (Optional.IsDefined(SemanticSearch)) + { + if (SemanticSearch != null) + { + writer.WritePropertyName("semanticSearch"u8); + writer.WriteStringValue(SemanticSearch.Value.ToString()); + } + else + { + writer.WriteNull("semanticSearch"); + } + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -120,6 +132,7 @@ internal static SearchServicePatch DeserializeSearchServicePatch(JsonElement ele Optional disableLocalAuth = default; Optional authOptions = default; Optional> privateEndpointConnections = default; + Optional semanticSearch = default; Optional> sharedPrivateLinkResources = default; foreach (var property in element.EnumerateObject()) { @@ -303,6 +316,16 @@ internal static SearchServicePatch DeserializeSearchServicePatch(JsonElement ele privateEndpointConnections = array; continue; } + if (property0.NameEquals("semanticSearch"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + semanticSearch = null; + continue; + } + semanticSearch = new SearchSemanticSearch(property0.Value.GetString()); + continue; + } if (property0.NameEquals("sharedPrivateLinkResources"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -321,7 +344,7 @@ internal static SearchServicePatch DeserializeSearchServicePatch(JsonElement ele continue; } } - return new SearchServicePatch(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, identity, Optional.ToNullable(replicaCount), Optional.ToNullable(partitionCount), Optional.ToNullable(hostingMode), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(status), statusDetails.Value, Optional.ToNullable(provisioningState), networkRuleSet.Value, encryptionWithCmk.Value, Optional.ToNullable(disableLocalAuth), authOptions.Value, Optional.ToList(privateEndpointConnections), Optional.ToList(sharedPrivateLinkResources)); + return new SearchServicePatch(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, identity, Optional.ToNullable(replicaCount), Optional.ToNullable(partitionCount), Optional.ToNullable(hostingMode), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(status), statusDetails.Value, Optional.ToNullable(provisioningState), networkRuleSet.Value, encryptionWithCmk.Value, Optional.ToNullable(disableLocalAuth), authOptions.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(semanticSearch), Optional.ToList(sharedPrivateLinkResources)); } } } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServicePatch.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServicePatch.cs index 9a2674bad24a5..e37a1b7e54e56 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServicePatch.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Models/SearchServicePatch.cs @@ -44,8 +44,9 @@ public SearchServicePatch(AzureLocation location) : base(location) /// When set to true, calls to the search service will not be permitted to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' are defined. /// Defines the options for how the data plane API of a search service authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. /// The list of private endpoint connections to the Azure Cognitive Search service. + /// Sets options that control the availability of semantic search. This configuration is only possible for certain Azure Cognitive Search SKUs in certain locations. /// The list of shared private link resources managed by the Azure Cognitive Search service. - internal SearchServicePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SearchSku sku, ManagedServiceIdentity identity, int? replicaCount, int? partitionCount, SearchServiceHostingMode? hostingMode, SearchServicePublicNetworkAccess? publicNetworkAccess, SearchServiceStatus? status, string statusDetails, SearchServiceProvisioningState? provisioningState, NetworkRuleSet networkRuleSet, SearchEncryptionWithCmk encryptionWithCmk, bool? isLocalAuthDisabled, SearchAadAuthDataPlaneAuthOptions authOptions, IReadOnlyList privateEndpointConnections, IReadOnlyList sharedPrivateLinkResources) : base(id, name, resourceType, systemData, tags, location) + internal SearchServicePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SearchSku sku, ManagedServiceIdentity identity, int? replicaCount, int? partitionCount, SearchServiceHostingMode? hostingMode, SearchServicePublicNetworkAccess? publicNetworkAccess, SearchServiceStatus? status, string statusDetails, SearchServiceProvisioningState? provisioningState, NetworkRuleSet networkRuleSet, SearchEncryptionWithCmk encryptionWithCmk, bool? isLocalAuthDisabled, SearchAadAuthDataPlaneAuthOptions authOptions, IReadOnlyList privateEndpointConnections, SearchSemanticSearch? semanticSearch, IReadOnlyList sharedPrivateLinkResources) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Identity = identity; @@ -61,6 +62,7 @@ internal SearchServicePatch(ResourceIdentifier id, string name, ResourceType res IsLocalAuthDisabled = isLocalAuthDisabled; AuthOptions = authOptions; PrivateEndpointConnections = privateEndpointConnections; + SemanticSearch = semanticSearch; SharedPrivateLinkResources = sharedPrivateLinkResources; } @@ -115,6 +117,8 @@ public IList IPRules public SearchAadAuthDataPlaneAuthOptions AuthOptions { get; set; } /// The list of private endpoint connections to the Azure Cognitive Search service. public IReadOnlyList PrivateEndpointConnections { get; } + /// Sets options that control the availability of semantic search. This configuration is only possible for certain Azure Cognitive Search SKUs in certain locations. + public SearchSemanticSearch? SemanticSearch { get; set; } /// The list of shared private link resources managed by the Azure Cognitive Search service. public IReadOnlyList SharedPrivateLinkResources { get; } } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/AdminKeysRestOperations.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/AdminKeysRestOperations.cs index 7a9958fa63e4d..60992c2008c09 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/AdminKeysRestOperations.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/AdminKeysRestOperations.cs @@ -33,7 +33,7 @@ public AdminKeysRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-01"; + _apiVersion = apiVersion ?? "2023-11-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index a3633b904f16b..57fa21ce230f2 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -33,7 +33,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-01"; + _apiVersion = apiVersion ?? "2023-11-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index fa0180b3c97d4..784ff23d43a55 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -33,7 +33,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-01"; + _apiVersion = apiVersion ?? "2023-11-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/QueryKeysRestOperations.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/QueryKeysRestOperations.cs index a3b16ea0e2b5d..987e342de6c1f 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/QueryKeysRestOperations.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/QueryKeysRestOperations.cs @@ -33,7 +33,7 @@ public QueryKeysRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-01"; + _apiVersion = apiVersion ?? "2023-11-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/SearchManagementRestOperations.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/SearchManagementRestOperations.cs new file mode 100644 index 0000000000000..4dc6f88e0198f --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/SearchManagementRestOperations.cs @@ -0,0 +1,118 @@ +// 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.ResourceManager.Search.Models; + +namespace Azure.ResourceManager.Search +{ + internal partial class SearchManagementRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SearchManagementRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SearchManagementRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateUsageBySubscriptionSkuRequest(string subscriptionId, AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Search/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/usages/", false); + uri.AppendPath(skuName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the quota usage for a search sku in the given subscription. + /// The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. + /// The unique location name for a Microsoft Azure geographic region. + /// The unique search service sku name supported by Azure Cognitive Search. + /// Parameter group. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> UsageBySubscriptionSkuAsync(string subscriptionId, AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + using var message = CreateUsageBySubscriptionSkuRequest(subscriptionId, location, skuName, searchManagementRequestOptions); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + QuotaUsageResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = QuotaUsageResult.DeserializeQuotaUsageResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the quota usage for a search sku in the given subscription. + /// The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. + /// The unique location name for a Microsoft Azure geographic region. + /// The unique search service sku name supported by Azure Cognitive Search. + /// Parameter group. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response UsageBySubscriptionSku(string subscriptionId, AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + using var message = CreateUsageBySubscriptionSkuRequest(subscriptionId, location, skuName, searchManagementRequestOptions); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + QuotaUsageResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = QuotaUsageResult.DeserializeQuotaUsageResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/ServicesRestOperations.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/ServicesRestOperations.cs index 50e0a70812153..35e4c64d47cf4 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/ServicesRestOperations.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/ServicesRestOperations.cs @@ -33,7 +33,7 @@ public ServicesRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-01"; + _apiVersion = apiVersion ?? "2023-11-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/SharedPrivateLinkResourcesRestOperations.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/SharedPrivateLinkResourcesRestOperations.cs index 58b3061f655b5..510e296fd0e95 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/SharedPrivateLinkResourcesRestOperations.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/SharedPrivateLinkResourcesRestOperations.cs @@ -33,7 +33,7 @@ public SharedPrivateLinkResourcesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-01"; + _apiVersion = apiVersion ?? "2023-11-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/UsagesRestOperations.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/UsagesRestOperations.cs new file mode 100644 index 0000000000000..3456138c4964f --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/RestOperations/UsagesRestOperations.cs @@ -0,0 +1,185 @@ +// 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.ResourceManager.Search.Models; + +namespace Azure.ResourceManager.Search +{ + internal partial class UsagesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of UsagesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public UsagesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Search/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/usages", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of all Search quota usages in the given subscription. + /// The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, location, searchManagementRequestOptions); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + QuotaUsagesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = QuotaUsagesListResult.DeserializeQuotaUsagesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of all Search quota usages in the given subscription. + /// The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, location, searchManagementRequestOptions); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + QuotaUsagesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = QuotaUsagesListResult.DeserializeQuotaUsagesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of all Search quota usages in the given subscription. + /// The URL to the next page of results. + /// The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, location, searchManagementRequestOptions); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + QuotaUsagesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = QuotaUsagesListResult.DeserializeQuotaUsagesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of all Search quota usages in the given subscription. + /// The URL to the next page of results. + /// The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, location, searchManagementRequestOptions); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + QuotaUsagesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = QuotaUsagesListResult.DeserializeQuotaUsagesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceData.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceData.cs index b576ec294090b..84ece8a27a774 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceData.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceData.cs @@ -47,8 +47,9 @@ public SearchServiceData(AzureLocation location) : base(location) /// When set to true, calls to the search service will not be permitted to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' are defined. /// Defines the options for how the data plane API of a search service authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. /// The list of private endpoint connections to the Azure Cognitive Search service. + /// Sets options that control the availability of semantic search. This configuration is only possible for certain Azure Cognitive Search SKUs in certain locations. /// The list of shared private link resources managed by the Azure Cognitive Search service. - internal SearchServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SearchSku sku, ManagedServiceIdentity identity, int? replicaCount, int? partitionCount, SearchServiceHostingMode? hostingMode, SearchServicePublicNetworkAccess? publicNetworkAccess, SearchServiceStatus? status, string statusDetails, SearchServiceProvisioningState? provisioningState, NetworkRuleSet networkRuleSet, SearchEncryptionWithCmk encryptionWithCmk, bool? isLocalAuthDisabled, SearchAadAuthDataPlaneAuthOptions authOptions, IReadOnlyList privateEndpointConnections, IReadOnlyList sharedPrivateLinkResources) : base(id, name, resourceType, systemData, tags, location) + internal SearchServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SearchSku sku, ManagedServiceIdentity identity, int? replicaCount, int? partitionCount, SearchServiceHostingMode? hostingMode, SearchServicePublicNetworkAccess? publicNetworkAccess, SearchServiceStatus? status, string statusDetails, SearchServiceProvisioningState? provisioningState, NetworkRuleSet networkRuleSet, SearchEncryptionWithCmk encryptionWithCmk, bool? isLocalAuthDisabled, SearchAadAuthDataPlaneAuthOptions authOptions, IReadOnlyList privateEndpointConnections, SearchSemanticSearch? semanticSearch, IReadOnlyList sharedPrivateLinkResources) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Identity = identity; @@ -64,6 +65,7 @@ internal SearchServiceData(ResourceIdentifier id, string name, ResourceType reso IsLocalAuthDisabled = isLocalAuthDisabled; AuthOptions = authOptions; PrivateEndpointConnections = privateEndpointConnections; + SemanticSearch = semanticSearch; SharedPrivateLinkResources = sharedPrivateLinkResources; } @@ -118,6 +120,8 @@ public IList IPRules public SearchAadAuthDataPlaneAuthOptions AuthOptions { get; set; } /// The list of private endpoint connections to the Azure Cognitive Search service. public IReadOnlyList PrivateEndpointConnections { get; } + /// Sets options that control the availability of semantic search. This configuration is only possible for certain Azure Cognitive Search SKUs in certain locations. + public SearchSemanticSearch? SemanticSearch { get; set; } /// The list of shared private link resources managed by the Azure Cognitive Search service. public IReadOnlyList SharedPrivateLinkResources { get; } } diff --git a/sdk/search/Azure.ResourceManager.Search/src/autorest.md b/sdk/search/Azure.ResourceManager.Search/src/autorest.md index 2aba249207dac..b5e9fc50c0633 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/autorest.md +++ b/sdk/search/Azure.ResourceManager.Search/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: Search namespace: Azure.ResourceManager.Search -require: https://github.com/Azure/azure-rest-api-specs/blob/20450db14856ccac2af2c28de56fd436c63bb726/specification/search/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/b934efa9501672e73686c2adbc7a4dcdd26e86c2/specification/search/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: @@ -91,5 +91,8 @@ directive: transform: > $.enum.includes('stopped') ? $.enum.splice($.enum.indexOf('stopped'), 1) : undefined; $['x-ms-enum'].values.map(e => e.value).includes('stopped') ? $['x-ms-enum'].values.splice($['x-ms-enum'].values.map(e => e.value).indexOf('stopped'), 1) : undefined; - + - from: search.json + where: $.definitions + transform: > + $.QuotaUsageResult.properties.id['x-ms-format'] = 'arm-id'; ``` diff --git a/sdk/search/Azure.ResourceManager.Search/tests/SearchManagementTestBase.cs b/sdk/search/Azure.ResourceManager.Search/tests/SearchManagementTestBase.cs index 3436ce710ef7e..6354d0562c079 100644 --- a/sdk/search/Azure.ResourceManager.Search/tests/SearchManagementTestBase.cs +++ b/sdk/search/Azure.ResourceManager.Search/tests/SearchManagementTestBase.cs @@ -14,7 +14,7 @@ public class SearchManagementTestBase : ManagementRecordedTestBase AzureLocation.EastUS; + public AzureLocation DefaultLocation => "eastus2euap"; public SubscriptionResource DefaultLSubscription { get; set; } diff --git a/sdk/search/Azure.ResourceManager.Search/tests/Tests/SearchServiceCollectionTests.cs b/sdk/search/Azure.ResourceManager.Search/tests/Tests/SearchServiceCollectionTests.cs index 8c9476b17bda9..2f519bf15dad2 100644 --- a/sdk/search/Azure.ResourceManager.Search/tests/Tests/SearchServiceCollectionTests.cs +++ b/sdk/search/Azure.ResourceManager.Search/tests/Tests/SearchServiceCollectionTests.cs @@ -40,7 +40,7 @@ public async Task CreateOrUpdateTest() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; var result = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -49,7 +49,7 @@ public async Task CreateOrUpdateTest() Assert.AreEqual(DefaultLocation, result.Data.Location); Assert.AreEqual(SearchSkuName.Standard, result.Data.Sku.Name); Assert.AreEqual(1, result.Data.PartitionCount); - Assert.AreEqual(3, result.Data.ReplicaCount); + Assert.AreEqual(1, result.Data.ReplicaCount); Assert.AreEqual(SearchServiceHostingMode.Default, result.Data.HostingMode); } @@ -63,7 +63,7 @@ public async Task GetAsyncTest() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; var result = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -74,7 +74,7 @@ public async Task GetAsyncTest() Assert.AreEqual(DefaultLocation, result.Data.Location); Assert.AreEqual(SearchSkuName.Standard, result.Data.Sku.Name); Assert.AreEqual(1, result.Data.PartitionCount); - Assert.AreEqual(3, result.Data.ReplicaCount); + Assert.AreEqual(1, result.Data.ReplicaCount); Assert.AreEqual(SearchServiceHostingMode.Default, result.Data.HostingMode); } @@ -88,7 +88,7 @@ public async Task GetAllAsyncTest() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; @@ -97,7 +97,7 @@ public async Task GetAllAsyncTest() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name1, data1); @@ -107,7 +107,7 @@ public async Task GetAllAsyncTest() Assert.AreEqual(2, searchServices.Count); Assert.IsTrue(searchServices.First(x => x.Data.Name == name1).Data.SkuName == SearchSkuName.Standard); Assert.IsTrue(searchServices.First(x => x.Data.Name == name1).Data.PartitionCount == 1); - Assert.IsTrue(searchServices.First(x => x.Data.Name == name1).Data.ReplicaCount == 3); + Assert.IsTrue(searchServices.First(x => x.Data.Name == name1).Data.ReplicaCount == 1); Assert.IsTrue(searchServices.First(x => x.Data.Name == name1).Data.HostingMode == SearchServiceHostingMode.Default); } [Test] @@ -120,7 +120,7 @@ public async Task ExistsAsync() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); diff --git a/sdk/search/Azure.ResourceManager.Search/tests/Tests/SearchServiceResourceTest.cs b/sdk/search/Azure.ResourceManager.Search/tests/Tests/SearchServiceResourceTest.cs index 8580c4deb223c..cea7738c7a441 100644 --- a/sdk/search/Azure.ResourceManager.Search/tests/Tests/SearchServiceResourceTest.cs +++ b/sdk/search/Azure.ResourceManager.Search/tests/Tests/SearchServiceResourceTest.cs @@ -38,7 +38,7 @@ public async Task GetAsyncTest() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -49,7 +49,7 @@ public async Task GetAsyncTest() Assert.AreEqual(DefaultLocation, result.Data.Location); Assert.AreEqual(SearchSkuName.Standard, result.Data.Sku.Name); Assert.AreEqual(1, result.Data.PartitionCount); - Assert.AreEqual(3, result.Data.ReplicaCount); + Assert.AreEqual(1, result.Data.ReplicaCount); Assert.AreEqual(SearchServiceHostingMode.Default, result.Data.HostingMode); } @@ -62,7 +62,7 @@ public async Task DeleteAsyncTest() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -83,14 +83,14 @@ public async Task UpdateAsyncTest() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; SearchServicePatch patch = new SearchServicePatch(DefaultLocation) { PartitionCount = 2, - ReplicaCount = 4, + ReplicaCount = 3, }; SearchServiceResource item = (await SearchResource.UpdateAsync(patch)).Value; Assert.IsNotNull(item); @@ -98,7 +98,7 @@ public async Task UpdateAsyncTest() Assert.AreEqual(name, item.Data.Name); Assert.AreEqual(SearchSkuName.Standard, item.Data.Sku.Name); Assert.AreEqual(2, item.Data.PartitionCount); - Assert.AreEqual(4, item.Data.ReplicaCount); + Assert.AreEqual(3, item.Data.ReplicaCount); Assert.AreEqual(SearchServiceHostingMode.Default, item.Data.HostingMode); } @@ -111,7 +111,7 @@ public async Task GetAdminKeyAsync() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -133,7 +133,7 @@ public async Task RegenerateAdminKeyAsync() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -157,7 +157,7 @@ public async Task CreateQueryKeyAsync() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -177,7 +177,7 @@ public async Task DeleteQueryKeyAsync() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -198,7 +198,7 @@ public async Task GetQueryKeysBySearchServiceAsyncTest() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -208,7 +208,7 @@ public async Task GetQueryKeysBySearchServiceAsyncTest() Assert.IsNotEmpty(list); Assert.AreEqual(queryName,list.First(item => item.Name == queryName).Name); Assert.IsNotNull(list.First(item => item.Name == queryName).Key); - Assert.AreEqual(originKey.Key, list.First(item => item.Name == queryName).Key); + Assert.IsNotEmpty(list.First(item => item.Name == queryName).Key); } [Test] public async Task AddTagAsync() @@ -219,7 +219,7 @@ public async Task AddTagAsync() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -241,7 +241,7 @@ public async Task SetTagsAsync() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -261,7 +261,7 @@ public async Task RemoveTagAsync() { SkuName = SearchSkuName.Standard, PartitionCount = 1, - ReplicaCount = 3, + ReplicaCount = 1, HostingMode = SearchServiceHostingMode.Default }; SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; @@ -336,5 +336,35 @@ public async Task DisableAndEnableLocalAuthAsync() Assert.IsNotNull(result.Data.AuthOptions.AadOrApiKey); Assert.AreEqual(SearchAadAuthFailureMode.Http403, result.Data.AuthOptions.AadOrApiKey.AadAuthFailureMode); } + + [Test] + public async Task DisableAndEnableSemanticSearchAsync() + { + await setResourceGroup(); + var name = Recording.GenerateAssetName("search"); + var data = new SearchServiceData(AzureLocation.WestCentralUS) + { + SkuName = SearchSkuName.Standard, + PartitionCount = 1, + ReplicaCount = 1, + SemanticSearch = SearchSemanticSearch.Disabled + }; + SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; + var result = (await SearchResource.GetAsync()).Value; + Assert.NotNull(result); + Assert.AreEqual(result.Data.SemanticSearch, SearchSemanticSearch.Disabled); + + data.SemanticSearch = SearchSemanticSearch.Free; + SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; + result = (await SearchResource.GetAsync()).Value; + Assert.NotNull(result); + Assert.AreEqual(result.Data.SemanticSearch, SearchSemanticSearch.Free); + + data.SemanticSearch = SearchSemanticSearch.Standard; + SearchResource = (await SearchCollection.CreateOrUpdateAsync(WaitUntil.Completed, name, data)).Value; + result = (await SearchResource.GetAsync()).Value; + Assert.NotNull(result); + Assert.AreEqual(result.Data.SemanticSearch, SearchSemanticSearch.Standard); + } } }