diff --git a/sdk/search/azure-resourcemanager-search/CHANGELOG.md b/sdk/search/azure-resourcemanager-search/CHANGELOG.md new file mode 100644 index 0000000000000..ade2f6ba07b34 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2024-05-23) + +- Azure Resource Manager Search client library for Java. This package contains Microsoft Azure SDK for Search Management SDK. Client that can be used to manage Azure AI Search services and API keys. Package tag package-preview-2024-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/search/azure-resourcemanager-search/README.md b/sdk/search/azure-resourcemanager-search/README.md new file mode 100644 index 0000000000000..1bc1cf231a62a --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/README.md @@ -0,0 +1,107 @@ +# Azure Resource Manager Search client library for Java + +Azure Resource Manager Search client library for Java. + +This package contains Microsoft Azure SDK for Search Management SDK. Client that can be used to manage Azure AI Search services and API keys. Package tag package-preview-2024-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-search;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-search + 2.39.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +SearchManager manager = SearchManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/search/azure-resourcemanager-search/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fsearch%2Fazure-resourcemanager-search%2FREADME.png) diff --git a/sdk/search/azure-resourcemanager-search/SAMPLE.md b/sdk/search/azure-resourcemanager-search/SAMPLE.md new file mode 100644 index 0000000000000..408761dd8971a --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/SAMPLE.md @@ -0,0 +1,1161 @@ +# Code snippets and samples + + +## AdminKeys + +- [Get](#adminkeys_get) +- [Regenerate](#adminkeys_regenerate) + +## NetworkSecurityPerimeterConfigurations + +- [Get](#networksecurityperimeterconfigurations_get) +- [ListByService](#networksecurityperimeterconfigurations_listbyservice) +- [Reconcile](#networksecurityperimeterconfigurations_reconcile) + +## Operations + +- [List](#operations_list) + +## PrivateEndpointConnections + +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByService](#privateendpointconnections_listbyservice) +- [Update](#privateendpointconnections_update) + +## PrivateLinkResources + +- [ListSupported](#privatelinkresources_listsupported) + +## QueryKeys + +- [Create](#querykeys_create) +- [Delete](#querykeys_delete) +- [ListBySearchService](#querykeys_listbysearchservice) + +## ResourceProvider + +- [UsageBySubscriptionSku](#resourceprovider_usagebysubscriptionsku) + +## Services + +- [CheckNameAvailability](#services_checknameavailability) +- [CreateOrUpdate](#services_createorupdate) +- [Delete](#services_delete) +- [GetByResourceGroup](#services_getbyresourcegroup) +- [List](#services_list) +- [ListByResourceGroup](#services_listbyresourcegroup) +- [Update](#services_update) + +## SharedPrivateLinkResources + +- [CreateOrUpdate](#sharedprivatelinkresources_createorupdate) +- [Delete](#sharedprivatelinkresources_delete) +- [Get](#sharedprivatelinkresources_get) +- [ListByService](#sharedprivatelinkresources_listbyservice) + +## Usages + +- [ListBySubscription](#usages_listbysubscription) +### AdminKeys_Get + +```java + +/** + * Samples for AdminKeys Get. + */ +public final class AdminKeysGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchGetAdminKeys.json + */ + /** + * Sample code: SearchGetAdminKeys. + * + * @param manager Entry point to SearchManager. + */ + public static void searchGetAdminKeys(com.azure.resourcemanager.search.SearchManager manager) { + manager.adminKeys().getWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} +``` + +### AdminKeys_Regenerate + +```java +import com.azure.resourcemanager.search.models.AdminKeyKind; + +/** + * Samples for AdminKeys Regenerate. + */ +public final class AdminKeysRegenerateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchRegenerateAdminKey.json + */ + /** + * Sample code: SearchRegenerateAdminKey. + * + * @param manager Entry point to SearchManager. + */ + public static void searchRegenerateAdminKey(com.azure.resourcemanager.search.SearchManager manager) { + manager.adminKeys() + .regenerateWithResponse("rg1", "mysearchservice", AdminKeyKind.PRIMARY, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkSecurityPerimeterConfigurations_Get + +```java +/** + * Samples for NetworkSecurityPerimeterConfigurations Get. + */ +public final class NetworkSecurityPerimeterConfigurationsGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurationsGet.json + */ + /** + * Sample code: Get an NSP config by name. + * + * @param manager Entry point to SearchManager. + */ + public static void getAnNSPConfigByName(com.azure.resourcemanager.search.SearchManager manager) { + manager.networkSecurityPerimeterConfigurations() + .getWithResponse("rg1", "mysearchservice", "00000001-2222-3333-4444-111144444444.assoc1", + com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkSecurityPerimeterConfigurations_ListByService + +```java +/** + * Samples for NetworkSecurityPerimeterConfigurations ListByService. + */ +public final class NetworkSecurityPerimeterConfigurationsListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurationsListByService.json + */ + /** + * Sample code: List NSP configs by search service. + * + * @param manager Entry point to SearchManager. + */ + public static void listNSPConfigsBySearchService(com.azure.resourcemanager.search.SearchManager manager) { + manager.networkSecurityPerimeterConfigurations() + .listByService("rg1", "mysearchservice", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkSecurityPerimeterConfigurations_Reconcile + +```java +/** + * Samples for NetworkSecurityPerimeterConfigurations Reconcile. + */ +public final class NetworkSecurityPerimeterConfigurationsReconcileSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurationsReconcile.json + */ + /** + * Sample code: Reconcile NSP Config. + * + * @param manager Entry point to SearchManager. + */ + public static void reconcileNSPConfig(com.azure.resourcemanager.search.SearchManager manager) { + manager.networkSecurityPerimeterConfigurations() + .reconcile("rg1", "mysearchservice", "00000001-2222-3333-4444-111144444444.assoc1", + com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListOperations.json + */ + /** + * Sample code: SearchListOperations. + * + * @param manager Entry point to SearchManager. + */ + public static void searchListOperations(com.azure.resourcemanager.search.SearchManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java + +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/DeletePrivateEndpointConnection.json + */ + /** + * Sample code: PrivateEndpointConnectionDelete. + * + * @param manager Entry point to SearchManager. + */ + public static void privateEndpointConnectionDelete(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateEndpointConnections() + .deleteWithResponse("rg1", "mysearchservice", "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java + +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetPrivateEndpointConnection.json + */ + /** + * Sample code: PrivateEndpointConnectionGet. + * + * @param manager Entry point to SearchManager. + */ + public static void privateEndpointConnectionGet(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateEndpointConnections() + .getWithResponse("rg1", "mysearchservice", "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByService + +```java + +/** + * Samples for PrivateEndpointConnections ListByService. + */ +public final class PrivateEndpointConnectionsListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/ListPrivateEndpointConnectionsByService.json + */ + /** + * Sample code: ListPrivateEndpointConnectionsByService. + * + * @param manager Entry point to SearchManager. + */ + public static void listPrivateEndpointConnectionsByService(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateEndpointConnections() + .listByService("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Update + +```java +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.search.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState; +import com.azure.resourcemanager.search.models.PrivateLinkServiceConnectionStatus; + +/** + * Samples for PrivateEndpointConnections Update. + */ +public final class PrivateEndpointConnectionsUpdateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/UpdatePrivateEndpointConnection.json + */ + /** + * Sample code: PrivateEndpointConnectionUpdate. + * + * @param manager Entry point to SearchManager. + */ + public static void privateEndpointConnectionUpdate(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateEndpointConnections() + .updateWithResponse("rg1", "mysearchservice", "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", + new PrivateEndpointConnectionInner() + .withProperties(new PrivateEndpointConnectionProperties().withPrivateLinkServiceConnectionState( + new PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState() + .withStatus(PrivateLinkServiceConnectionStatus.REJECTED) + .withDescription("Rejected for some reason."))), + null, com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkResources_ListSupported + +```java + +/** + * Samples for PrivateLinkResources ListSupported. + */ +public final class PrivateLinkResourcesListSupportedSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/ListSupportedPrivateLinkResources.json + */ + /** + * Sample code: ListSupportedPrivateLinkResources. + * + * @param manager Entry point to SearchManager. + */ + public static void listSupportedPrivateLinkResources(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateLinkResources().listSupported("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} +``` + +### QueryKeys_Create + +```java + +/** + * Samples for QueryKeys Create. + */ +public final class QueryKeysCreateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateQueryKey.json + */ + /** + * Sample code: SearchCreateQueryKey. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateQueryKey(com.azure.resourcemanager.search.SearchManager manager) { + manager.queryKeys() + .createWithResponse("rg1", "mysearchservice", + "An API key granting read-only access to the documents collection of an index.", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### QueryKeys_Delete + +```java + +/** + * Samples for QueryKeys Delete. + */ +public final class QueryKeysDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchDeleteQueryKey.json + */ + /** + * Sample code: SearchDeleteQueryKey. + * + * @param manager Entry point to SearchManager. + */ + public static void searchDeleteQueryKey(com.azure.resourcemanager.search.SearchManager manager) { + manager.queryKeys() + .deleteWithResponse("rg1", "mysearchservice", "", null, com.azure.core.util.Context.NONE); + } +} +``` + +### QueryKeys_ListBySearchService + +```java + +/** + * Samples for QueryKeys ListBySearchService. + */ +public final class QueryKeysListBySearchServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListQueryKeysBySearchService.json + */ + /** + * Sample code: SearchListQueryKeysBySearchService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchListQueryKeysBySearchService(com.azure.resourcemanager.search.SearchManager manager) { + manager.queryKeys().listBySearchService("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_UsageBySubscriptionSku + +```java + +/** + * Samples for ResourceProvider UsageBySubscriptionSku. + */ +public final class ResourceProviderUsageBySubscriptionSkuSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetQuotaUsage.json + */ + /** + * Sample code: GetQuotaUsage. + * + * @param manager Entry point to SearchManager. + */ + public static void getQuotaUsage(com.azure.resourcemanager.search.SearchManager manager) { + manager.resourceProviders() + .usageBySubscriptionSkuWithResponse("westus", "free", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Services_CheckNameAvailability + +```java +import com.azure.resourcemanager.search.models.CheckNameAvailabilityInput; + +/** + * Samples for Services CheckNameAvailability. + */ +public final class ServicesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCheckNameAvailability.json + */ + /** + * Sample code: SearchCheckNameAvailability. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCheckNameAvailability(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityInput().withName("mysearchservice"), null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Services_CreateOrUpdate + +```java +import com.azure.resourcemanager.search.models.AadAuthFailureMode; +import com.azure.resourcemanager.search.models.DataPlaneAadOrApiKeyAuthOption; +import com.azure.resourcemanager.search.models.DataPlaneAuthOptions; +import com.azure.resourcemanager.search.models.EncryptionWithCmk; +import com.azure.resourcemanager.search.models.HostingMode; +import com.azure.resourcemanager.search.models.Identity; +import com.azure.resourcemanager.search.models.IdentityType; +import com.azure.resourcemanager.search.models.IpRule; +import com.azure.resourcemanager.search.models.NetworkRuleSet; +import com.azure.resourcemanager.search.models.PublicNetworkAccess; +import com.azure.resourcemanager.search.models.SearchBypass; +import com.azure.resourcemanager.search.models.SearchDisabledDataExfiltrationOption; +import com.azure.resourcemanager.search.models.SearchEncryptionWithCmk; +import com.azure.resourcemanager.search.models.SearchSemanticSearch; +import com.azure.resourcemanager.search.models.Sku; +import com.azure.resourcemanager.search.models.SkuName; +import com.azure.resourcemanager.search.models.UserAssignedManagedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Services CreateOrUpdate. + */ +public final class ServicesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints( + com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateService.json + */ + /** + * Sample code: SearchCreateOrUpdateService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateService(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceAuthOptions.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceAuthOptions. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceAuthOptions(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withAuthOptions(new DataPlaneAuthOptions().withAadOrApiKey(new DataPlaneAadOrApiKeyAuthOption() + .withAadAuthFailureMode(AadAuthFailureMode.HTTP401WITH_BEARER_CHALLENGE))) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateWithSemanticSearch.json + */ + /** + * Sample code: SearchCreateOrUpdateWithSemanticSearch. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateWithSemanticSearch(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withSemanticSearch(SearchSemanticSearch.FREE) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceWithIdentity.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceWithIdentity. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceWithIdentity(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withIdentity(new Identity().withType(IdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi", + new UserAssignedManagedIdentity()))) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass( + com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(1) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withNetworkRuleSet(new NetworkRuleSet() + .withIpRules(Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18"))) + .withBypass(SearchBypass.AZURE_PORTAL)) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceDisableLocalAuth. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchCreateOrUpdateServiceDisableLocalAuth(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withDisableLocalAuth(true) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs( + com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(1) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withNetworkRuleSet(new NetworkRuleSet().withIpRules( + Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18")))) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceWithCmkEnforcement. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchCreateOrUpdateServiceWithCmkEnforcement(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withEncryptionWithCmk(new EncryptionWithCmk().withEnforcement(SearchEncryptionWithCmk.ENABLED)) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceWithDataExfiltration.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceWithDataExfiltration. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchCreateOrUpdateServiceWithDataExfiltration(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withDisabledDataExfiltrationOptions(Arrays.asList(SearchDisabledDataExfiltrationOption.ALL)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Services_Delete + +```java + +/** + * Samples for Services Delete. + */ +public final class ServicesDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchDeleteService.json + */ + /** + * Sample code: SearchDeleteService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchDeleteService(com.azure.resourcemanager.search.SearchManager manager) { + manager.services().deleteWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Services_GetByResourceGroup + +```java + +/** + * Samples for Services GetByResourceGroup. + */ +public final class ServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchGetService.json + */ + /** + * Sample code: SearchGetService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchGetService(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Services_List + +```java + +/** + * Samples for Services List. + */ +public final class ServicesListSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListServicesBySubscription.json + */ + /** + * Sample code: SearchListServicesBySubscription. + * + * @param manager Entry point to SearchManager. + */ + public static void searchListServicesBySubscription(com.azure.resourcemanager.search.SearchManager manager) { + manager.services().list(null, com.azure.core.util.Context.NONE); + } +} +``` + +### Services_ListByResourceGroup + +```java + +/** + * Samples for Services ListByResourceGroup. + */ +public final class ServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListServicesByResourceGroup.json + */ + /** + * Sample code: SearchListServicesByResourceGroup. + * + * @param manager Entry point to SearchManager. + */ + public static void searchListServicesByResourceGroup(com.azure.resourcemanager.search.SearchManager manager) { + manager.services().listByResourceGroup("rg1", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Services_Update + +```java +import com.azure.resourcemanager.search.models.AadAuthFailureMode; +import com.azure.resourcemanager.search.models.DataPlaneAadOrApiKeyAuthOption; +import com.azure.resourcemanager.search.models.DataPlaneAuthOptions; +import com.azure.resourcemanager.search.models.EncryptionWithCmk; +import com.azure.resourcemanager.search.models.Identity; +import com.azure.resourcemanager.search.models.IdentityType; +import com.azure.resourcemanager.search.models.IpRule; +import com.azure.resourcemanager.search.models.NetworkRuleSet; +import com.azure.resourcemanager.search.models.PublicNetworkAccess; +import com.azure.resourcemanager.search.models.SearchBypass; +import com.azure.resourcemanager.search.models.SearchDisabledDataExfiltrationOption; +import com.azure.resourcemanager.search.models.SearchEncryptionWithCmk; +import com.azure.resourcemanager.search.models.SearchSemanticSearch; +import com.azure.resourcemanager.search.models.SearchService; +import com.azure.resourcemanager.search.models.Sku; +import com.azure.resourcemanager.search.models.SkuName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Services Update. + */ +public final class ServicesUpdateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceDisableLocalAuth.json + */ + /** + * Sample code: SearchUpdateServiceDisableLocalAuth. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceDisableLocalAuth(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withDisableLocalAuth(true) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json + */ + /** + * Sample code: SearchUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass( + com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withReplicaCount(3) + .withPartitionCount(1) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withNetworkRuleSet(new NetworkRuleSet() + .withIpRules(Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18"))) + .withBypass(SearchBypass.AZURE_PORTAL)) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceWithCmkEnforcement.json + */ + /** + * Sample code: SearchUpdateServiceWithCmkEnforcement. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceWithCmkEnforcement(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withEncryptionWithCmk(new EncryptionWithCmk().withEnforcement(SearchEncryptionWithCmk.ENABLED)) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceWithDataExfiltration.json + */ + /** + * Sample code: SearchUpdateServiceWithDataExfiltration. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceWithDataExfiltration(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withDisabledDataExfiltrationOptions(Arrays.asList(SearchDisabledDataExfiltrationOption.ALL)) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToRemoveIdentity.json + */ + /** + * Sample code: SearchUpdateServiceToRemoveIdentity. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceToRemoveIdentity(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withSku(new Sku().withName(SkuName.STANDARD)) + .withIdentity(new Identity().withType(IdentityType.NONE)) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceWithSemanticSearch.json + */ + /** + * Sample code: SearchUpdateServiceWithSemanticSearch. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceWithSemanticSearch(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withSemanticSearch(SearchSemanticSearch.STANDARD) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json + */ + /** + * Sample code: SearchUpdateServiceToAllowAccessFromPrivateEndpoints. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchUpdateServiceToAllowAccessFromPrivateEndpoints(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withReplicaCount(1) + .withPartitionCount(1) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json + */ + /** + * Sample code: SearchUpdateServiceToAllowAccessFromPublicCustomIPs. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchUpdateServiceToAllowAccessFromPublicCustomIPs(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withReplicaCount(3) + .withPartitionCount(1) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withNetworkRuleSet(new NetworkRuleSet().withIpRules( + Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18")))) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceAuthOptions.json + */ + /** + * Sample code: SearchUpdateServiceAuthOptions. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceAuthOptions(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withAuthOptions(new DataPlaneAuthOptions().withAadOrApiKey(new DataPlaneAadOrApiKeyAuthOption() + .withAadAuthFailureMode(AadAuthFailureMode.HTTP401WITH_BEARER_CHALLENGE))) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateService.json + */ + /** + * Sample code: SearchUpdateService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateService(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SharedPrivateLinkResources_CreateOrUpdate + +```java +import com.azure.resourcemanager.search.models.SharedPrivateLinkResourceProperties; + +/** + * Samples for SharedPrivateLinkResources CreateOrUpdate. + */ +public final class SharedPrivateLinkResourcesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/CreateOrUpdateSharedPrivateLinkResource.json + */ + /** + * Sample code: SharedPrivateLinkResourceCreateOrUpdate. + * + * @param manager Entry point to SearchManager. + */ + public static void sharedPrivateLinkResourceCreateOrUpdate(com.azure.resourcemanager.search.SearchManager manager) { + manager.sharedPrivateLinkResources() + .define("testResource") + .withExistingSearchService("rg1", "mysearchservice") + .withProperties(new SharedPrivateLinkResourceProperties().withPrivateLinkResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName") + .withGroupId("blob") + .withRequestMessage("please approve")) + .create(); + } +} +``` + +### SharedPrivateLinkResources_Delete + +```java + +/** + * Samples for SharedPrivateLinkResources Delete. + */ +public final class SharedPrivateLinkResourcesDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/DeleteSharedPrivateLinkResource.json + */ + /** + * Sample code: SharedPrivateLinkResourceDelete. + * + * @param manager Entry point to SearchManager. + */ + public static void sharedPrivateLinkResourceDelete(com.azure.resourcemanager.search.SearchManager manager) { + manager.sharedPrivateLinkResources() + .delete("rg1", "mysearchservice", "testResource", null, com.azure.core.util.Context.NONE); + } +} +``` + +### SharedPrivateLinkResources_Get + +```java + +/** + * Samples for SharedPrivateLinkResources Get. + */ +public final class SharedPrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetSharedPrivateLinkResource.json + */ + /** + * Sample code: SharedPrivateLinkResourceGet. + * + * @param manager Entry point to SearchManager. + */ + public static void sharedPrivateLinkResourceGet(com.azure.resourcemanager.search.SearchManager manager) { + manager.sharedPrivateLinkResources() + .getWithResponse("rg1", "mysearchservice", "testResource", null, com.azure.core.util.Context.NONE); + } +} +``` + +### SharedPrivateLinkResources_ListByService + +```java + +/** + * Samples for SharedPrivateLinkResources ListByService. + */ +public final class SharedPrivateLinkResourcesListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/ListSharedPrivateLinkResourcesByService.json + */ + /** + * Sample code: ListSharedPrivateLinkResourcesByService. + * + * @param manager Entry point to SearchManager. + */ + public static void listSharedPrivateLinkResourcesByService(com.azure.resourcemanager.search.SearchManager manager) { + manager.sharedPrivateLinkResources() + .listByService("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Usages_ListBySubscription + +```java + +/** + * Samples for Usages ListBySubscription. + */ +public final class UsagesListBySubscriptionSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetQuotaUsagesList.json + */ + /** + * Sample code: GetQuotaUsagesList. + * + * @param manager Entry point to SearchManager. + */ + public static void getQuotaUsagesList(com.azure.resourcemanager.search.SearchManager manager) { + manager.usages().listBySubscription("westus", null, com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/search/azure-resourcemanager-search/pom.xml b/sdk/search/azure-resourcemanager-search/pom.xml new file mode 100644 index 0000000000000..b9b1fb8d49bff --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-search + 2.39.0-beta.1 + jar + + Microsoft Azure SDK for Search Management + This package contains Microsoft Azure SDK for Search Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Client that can be used to manage Azure AI Search services and API keys. Package tag package-preview-2024-06. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.49.0 + + + com.azure + azure-core-management + 1.14.0 + + + diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/SearchManager.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/SearchManager.java new file mode 100644 index 0000000000000..1086a96d365d9 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/SearchManager.java @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.SearchManagementClient; +import com.azure.resourcemanager.search.implementation.AdminKeysImpl; +import com.azure.resourcemanager.search.implementation.NetworkSecurityPerimeterConfigurationsImpl; +import com.azure.resourcemanager.search.implementation.OperationsImpl; +import com.azure.resourcemanager.search.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.search.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.search.implementation.QueryKeysImpl; +import com.azure.resourcemanager.search.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.search.implementation.SearchManagementClientBuilder; +import com.azure.resourcemanager.search.implementation.ServicesImpl; +import com.azure.resourcemanager.search.implementation.SharedPrivateLinkResourcesImpl; +import com.azure.resourcemanager.search.implementation.UsagesImpl; +import com.azure.resourcemanager.search.models.AdminKeys; +import com.azure.resourcemanager.search.models.NetworkSecurityPerimeterConfigurations; +import com.azure.resourcemanager.search.models.Operations; +import com.azure.resourcemanager.search.models.PrivateEndpointConnections; +import com.azure.resourcemanager.search.models.PrivateLinkResources; +import com.azure.resourcemanager.search.models.QueryKeys; +import com.azure.resourcemanager.search.models.ResourceProviders; +import com.azure.resourcemanager.search.models.Services; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResources; +import com.azure.resourcemanager.search.models.Usages; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to SearchManager. + * Client that can be used to manage Azure AI Search services and API keys. + */ +public final class SearchManager { + private Operations operations; + + private AdminKeys adminKeys; + + private QueryKeys queryKeys; + + private Services services; + + private PrivateLinkResources privateLinkResources; + + private PrivateEndpointConnections privateEndpointConnections; + + private SharedPrivateLinkResources sharedPrivateLinkResources; + + private Usages usages; + + private ResourceProviders resourceProviders; + + private NetworkSecurityPerimeterConfigurations networkSecurityPerimeterConfigurations; + + private final SearchManagementClient clientObject; + + private SearchManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new SearchManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Search service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Search service API instance. + */ + public static SearchManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Search service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Search service API instance. + */ + public static SearchManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new SearchManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create SearchManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new SearchManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Search service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Search service API instance. + */ + public SearchManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.search") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new SearchManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of AdminKeys. + * + * @return Resource collection API of AdminKeys. + */ + public AdminKeys adminKeys() { + if (this.adminKeys == null) { + this.adminKeys = new AdminKeysImpl(clientObject.getAdminKeys(), this); + } + return adminKeys; + } + + /** + * Gets the resource collection API of QueryKeys. + * + * @return Resource collection API of QueryKeys. + */ + public QueryKeys queryKeys() { + if (this.queryKeys == null) { + this.queryKeys = new QueryKeysImpl(clientObject.getQueryKeys(), this); + } + return queryKeys; + } + + /** + * Gets the resource collection API of Services. It manages SearchService. + * + * @return Resource collection API of Services. + */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(clientObject.getServices(), this); + } + return services; + } + + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * Gets the resource collection API of PrivateEndpointConnections. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections + = new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of SharedPrivateLinkResources. It manages SharedPrivateLinkResource. + * + * @return Resource collection API of SharedPrivateLinkResources. + */ + public SharedPrivateLinkResources sharedPrivateLinkResources() { + if (this.sharedPrivateLinkResources == null) { + this.sharedPrivateLinkResources + = new SharedPrivateLinkResourcesImpl(clientObject.getSharedPrivateLinkResources(), this); + } + return sharedPrivateLinkResources; + } + + /** + * Gets the resource collection API of Usages. + * + * @return Resource collection API of Usages. + */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(clientObject.getUsages(), this); + } + return usages; + } + + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** + * Gets the resource collection API of NetworkSecurityPerimeterConfigurations. + * + * @return Resource collection API of NetworkSecurityPerimeterConfigurations. + */ + public NetworkSecurityPerimeterConfigurations networkSecurityPerimeterConfigurations() { + if (this.networkSecurityPerimeterConfigurations == null) { + this.networkSecurityPerimeterConfigurations = new NetworkSecurityPerimeterConfigurationsImpl( + clientObject.getNetworkSecurityPerimeterConfigurations(), this); + } + return networkSecurityPerimeterConfigurations; + } + + /** + * Gets wrapped service client SearchManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client SearchManagementClient. + */ + public SearchManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/AdminKeysClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/AdminKeysClient.java new file mode 100644 index 0000000000000..e64d878da1258 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/AdminKeysClient.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.AdminKeyResultInner; +import com.azure.resourcemanager.search.models.AdminKeyKind; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in AdminKeysClient. + */ +public interface AdminKeysClient { + /** + * Gets the primary and secondary admin API keys for the specified Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the primary and secondary admin API keys for the specified Azure AI Search service along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); + + /** + * Gets the primary and secondary admin API keys for the specified Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the primary and secondary admin API keys for the specified Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdminKeyResultInner get(String resourceGroupName, String searchServiceName); + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the primary and secondary admin API keys for a given Azure AI Search service along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateWithResponse(String resourceGroupName, String searchServiceName, + AdminKeyKind keyKind, UUID clientRequestId, Context context); + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the primary and secondary admin API keys for a given Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdminKeyResultInner regenerate(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/NetworkSecurityPerimeterConfigurationsClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/NetworkSecurityPerimeterConfigurationsClient.java new file mode 100644 index 0000000000000..177b50d22358b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/NetworkSecurityPerimeterConfigurationsClient.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.search.fluent.models.NetworkSecurityPerimeterConfigurationInner; + +/** + * An instance of this class provides access to all the operations defined in + * NetworkSecurityPerimeterConfigurationsClient. + */ +public interface NetworkSecurityPerimeterConfigurationsClient { + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByService(String resourceGroupName, + String searchServiceName); + + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByService(String resourceGroupName, + String searchServiceName, Context context); + + /** + * Gets a network security perimeter configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a network security perimeter configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, + String searchServiceName, String nspConfigName, Context context); + + /** + * Gets a network security perimeter configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a network security perimeter configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkSecurityPerimeterConfigurationInner get(String resourceGroupName, String searchServiceName, + String nspConfigName); + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReconcile(String resourceGroupName, String searchServiceName, + String nspConfigName); + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginReconcile(String resourceGroupName, String searchServiceName, + String nspConfigName, Context context); + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void reconcile(String resourceGroupName, String searchServiceName, String nspConfigName); + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void reconcile(String resourceGroupName, String searchServiceName, String nspConfigName, Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/OperationsClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/OperationsClient.java new file mode 100644 index 0000000000000..c08e6a9aa7dd5 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/PrivateEndpointConnectionsClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..b65d15ac5859d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. + */ +public interface PrivateEndpointConnectionsClient { + /** + * Updates a private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param privateEndpointConnection The definition of the private endpoint connection to update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, + UUID clientRequestId, Context context); + + /** + * Updates a private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param privateEndpointConnection The definition of the private endpoint connection to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner update(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Gets the details of the private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the private endpoint connection to the search service in the given resource group along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, UUID clientRequestId, Context context); + + /** + * Gets the details of the private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the private endpoint connection to the search service in the given resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName); + + /** + * Disconnects the private endpoint connection and deletes it from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, UUID clientRequestId, Context context); + + /** + * Disconnects the private endpoint connection and deletes it from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner delete(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName); + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByService(String resourceGroupName, String searchServiceName); + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/PrivateLinkResourcesClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..057aed8580616 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.PrivateLinkResourceInner; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public interface PrivateLinkResourcesClient { + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSupported(String resourceGroupName, String searchServiceName); + + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSupported(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/QueryKeysClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/QueryKeysClient.java new file mode 100644 index 0000000000000..835ab0ac1ec55 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/QueryKeysClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.QueryKeyInner; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in QueryKeysClient. + */ +public interface QueryKeysClient { + /** + * Generates a new query key for the specified search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs + * collection of an index along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String searchServiceName, String name, + UUID clientRequestId, Context context); + + /** + * Generates a new query key for the specified search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs + * collection of an index. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryKeyInner create(String resourceGroupName, String searchServiceName, String name); + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySearchService(String resourceGroupName, String searchServiceName); + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySearchService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating + * a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String searchServiceName, String key, + UUID clientRequestId, Context context); + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating + * a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String searchServiceName, String key); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/ResourceProvidersClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..84ab45b42b4e0 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/ResourceProvidersClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public interface ResourceProvidersClient { + /** + * Gets the quota usage for a search sku in the given subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param skuName The unique SKU name that identifies a billable tier. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the quota usage for a search sku in the given subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response usageBySubscriptionSkuWithResponse(String location, String skuName, + UUID clientRequestId, Context context); + + /** + * Gets the quota usage for a search sku in the given subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param skuName The unique SKU name that identifies a billable tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the quota usage for a search sku in the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QuotaUsageResultInner usageBySubscriptionSku(String location, String skuName); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SearchManagementClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SearchManagementClient.java new file mode 100644 index 0000000000000..b135a2eb748b6 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SearchManagementClient.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for SearchManagementClient class. + */ +public interface SearchManagementClient { + /** + * Gets The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource + * Manager API or the portal. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the AdminKeysClient object to access its operations. + * + * @return the AdminKeysClient object. + */ + AdminKeysClient getAdminKeys(); + + /** + * Gets the QueryKeysClient object to access its operations. + * + * @return the QueryKeysClient object. + */ + QueryKeysClient getQueryKeys(); + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + ServicesClient getServices(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the SharedPrivateLinkResourcesClient object to access its operations. + * + * @return the SharedPrivateLinkResourcesClient object. + */ + SharedPrivateLinkResourcesClient getSharedPrivateLinkResources(); + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + UsagesClient getUsages(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the NetworkSecurityPerimeterConfigurationsClient object to access its operations. + * + * @return the NetworkSecurityPerimeterConfigurationsClient object. + */ + NetworkSecurityPerimeterConfigurationsClient getNetworkSecurityPerimeterConfigurations(); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/ServicesClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/ServicesClient.java new file mode 100644 index 0000000000000..2992c0e2042d4 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/ServicesClient.java @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.search.fluent.models.CheckNameAvailabilityOutputInner; +import com.azure.resourcemanager.search.fluent.models.SearchServiceInner; +import com.azure.resourcemanager.search.models.CheckNameAvailabilityInput; +import com.azure.resourcemanager.search.models.SearchServiceUpdate; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in ServicesClient. + */ +public interface ServicesClient { + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SearchServiceInner> beginCreateOrUpdate(String resourceGroupName, + String searchServiceName, SearchServiceInner serviceParam); + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SearchServiceInner> beginCreateOrUpdate(String resourceGroupName, + String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId, Context context); + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SearchServiceInner createOrUpdate(String resourceGroupName, String searchServiceName, + SearchServiceInner serviceParam); + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SearchServiceInner createOrUpdate(String resourceGroupName, String searchServiceName, + SearchServiceInner serviceParam, UUID clientRequestId, Context context); + + /** + * Updates an existing search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to update. + * @param serviceParam The definition of the search service to update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String searchServiceName, + SearchServiceUpdate serviceParam, UUID clientRequestId, Context context); + + /** + * Updates an existing search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to update. + * @param serviceParam The definition of the search service to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SearchServiceInner update(String resourceGroupName, String searchServiceName, SearchServiceUpdate serviceParam); + + /** + * Gets the search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); + + /** + * Gets the search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SearchServiceInner getByResourceGroup(String resourceGroupName, String searchServiceName); + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String searchServiceName, UUID clientRequestId, + Context context); + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String searchServiceName); + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, UUID clientRequestId, + Context context); + + /** + * Gets a list of all Search services in the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all Search services in the given subscription. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(UUID clientRequestId, Context context); + + /** + * Checks whether or not the given search service name is available for use. Search service names must be globally + * unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param checkNameAvailabilityInput The resource name and type to check. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of check name availability API along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityInput checkNameAvailabilityInput, UUID clientRequestId, Context context); + + /** + * Checks whether or not the given search service name is available for use. Search service names must be globally + * unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param checkNameAvailabilityInput The resource name and type to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of check name availability API. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityOutputInner checkNameAvailability(CheckNameAvailabilityInput checkNameAvailabilityInput); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SharedPrivateLinkResourcesClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SharedPrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..dad11cf25aa31 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SharedPrivateLinkResourcesClient.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in SharedPrivateLinkResourcesClient. + */ +public interface SharedPrivateLinkResourcesClient { + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a shared private link resource managed by the Azure AI + * Search service. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SharedPrivateLinkResourceInner> beginCreateOrUpdate( + String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource); + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a shared private link resource managed by the Azure AI + * Search service. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SharedPrivateLinkResourceInner> beginCreateOrUpdate( + String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource, UUID clientRequestId, Context context); + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a shared private link resource managed by the Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedPrivateLinkResourceInner createOrUpdate(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource); + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a shared private link resource managed by the Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedPrivateLinkResourceInner createOrUpdate(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId, Context context); + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource group + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId, Context context); + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource + * group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedPrivateLinkResourceInner get(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName); + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName); + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId, Context context); + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName); + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName, + UUID clientRequestId, Context context); + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByService(String resourceGroupName, String searchServiceName); + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/UsagesClient.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/UsagesClient.java new file mode 100644 index 0000000000000..ae61269576304 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/UsagesClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner; +import java.util.UUID; + +/** + * An instance of this class provides access to all the operations defined in UsagesClient. + */ +public interface UsagesClient { + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String location); + + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String location, UUID clientRequestId, Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/AdminKeyResultInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/AdminKeyResultInner.java new file mode 100644 index 0000000000000..e9aba2d283840 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/AdminKeyResultInner.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response containing the primary and secondary admin API keys for a given Azure AI Search service. + */ +@Immutable +public final class AdminKeyResultInner { + /* + * The primary admin API key of the search service. + */ + @JsonProperty(value = "primaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryKey; + + /* + * The secondary admin API key of the search service. + */ + @JsonProperty(value = "secondaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryKey; + + /** + * Creates an instance of AdminKeyResultInner class. + */ + public AdminKeyResultInner() { + } + + /** + * Get the primaryKey property: The primary admin API key of the search service. + * + * @return the primaryKey value. + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Get the secondaryKey property: The secondary admin API key of the search service. + * + * @return the secondaryKey value. + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/CheckNameAvailabilityOutputInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/CheckNameAvailabilityOutputInner.java new file mode 100644 index 0000000000000..43d8df9251e27 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/CheckNameAvailabilityOutputInner.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.search.models.UnavailableNameReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Output of check name availability API. + */ +@Immutable +public final class CheckNameAvailabilityOutputInner { + /* + * A value indicating whether the name is available. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isNameAvailable; + + /* + * The reason why the name is not available. 'Invalid' indicates the name provided does not match the naming requirements (incorrect length, unsupported characters, etc.). 'AlreadyExists' indicates that the name is already in use and is therefore unavailable. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private UnavailableNameReason reason; + + /* + * A message that explains why the name is invalid and provides resource naming requirements. Available only if 'Invalid' is returned in the 'reason' property. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Creates an instance of CheckNameAvailabilityOutputInner class. + */ + public CheckNameAvailabilityOutputInner() { + } + + /** + * Get the isNameAvailable property: A value indicating whether the name is available. + * + * @return the isNameAvailable value. + */ + public Boolean isNameAvailable() { + return this.isNameAvailable; + } + + /** + * Get the reason property: The reason why the name is not available. 'Invalid' indicates the name provided does not + * match the naming requirements (incorrect length, unsupported characters, etc.). 'AlreadyExists' indicates that + * the name is already in use and is therefore unavailable. + * + * @return the reason value. + */ + public UnavailableNameReason reason() { + return this.reason; + } + + /** + * Get the message property: A message that explains why the name is invalid and provides resource naming + * requirements. Available only if 'Invalid' is returned in the 'reason' property. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/NetworkSecurityPerimeterConfigurationInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/NetworkSecurityPerimeterConfigurationInner.java new file mode 100644 index 0000000000000..6e8fafad86f13 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/NetworkSecurityPerimeterConfigurationInner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.search.models.NspConfigAssociation; +import com.azure.resourcemanager.search.models.NspConfigPerimeter; +import com.azure.resourcemanager.search.models.NspConfigProfile; +import com.azure.resourcemanager.search.models.NspProvisioningIssue; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Network security perimeter configuration for a server. + */ +@Fluent +public final class NetworkSecurityPerimeterConfigurationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private NetworkSecurityPerimeterConfigurationProperties innerProperties; + + /** + * Creates an instance of NetworkSecurityPerimeterConfigurationInner class. + */ + public NetworkSecurityPerimeterConfigurationInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private NetworkSecurityPerimeterConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the networkSecurityPerimeter property: The perimeter for a network security perimeter configuration. + * + * @return the networkSecurityPerimeter value. + */ + public NspConfigPerimeter networkSecurityPerimeter() { + return this.innerProperties() == null ? null : this.innerProperties().networkSecurityPerimeter(); + } + + /** + * Set the networkSecurityPerimeter property: The perimeter for a network security perimeter configuration. + * + * @param networkSecurityPerimeter the networkSecurityPerimeter value to set. + * @return the NetworkSecurityPerimeterConfigurationInner object itself. + */ + public NetworkSecurityPerimeterConfigurationInner + withNetworkSecurityPerimeter(NspConfigPerimeter networkSecurityPerimeter) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkSecurityPerimeterConfigurationProperties(); + } + this.innerProperties().withNetworkSecurityPerimeter(networkSecurityPerimeter); + return this; + } + + /** + * Get the resourceAssociation property: The resource association for the network security perimeter. + * + * @return the resourceAssociation value. + */ + public NspConfigAssociation resourceAssociation() { + return this.innerProperties() == null ? null : this.innerProperties().resourceAssociation(); + } + + /** + * Set the resourceAssociation property: The resource association for the network security perimeter. + * + * @param resourceAssociation the resourceAssociation value to set. + * @return the NetworkSecurityPerimeterConfigurationInner object itself. + */ + public NetworkSecurityPerimeterConfigurationInner + withResourceAssociation(NspConfigAssociation resourceAssociation) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkSecurityPerimeterConfigurationProperties(); + } + this.innerProperties().withResourceAssociation(resourceAssociation); + return this; + } + + /** + * Get the profile property: The profile for a network security perimeter configuration. + * + * @return the profile value. + */ + public NspConfigProfile profile() { + return this.innerProperties() == null ? null : this.innerProperties().profile(); + } + + /** + * Set the profile property: The profile for a network security perimeter configuration. + * + * @param profile the profile value to set. + * @return the NetworkSecurityPerimeterConfigurationInner object itself. + */ + public NetworkSecurityPerimeterConfigurationInner withProfile(NspConfigProfile profile) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkSecurityPerimeterConfigurationProperties(); + } + this.innerProperties().withProfile(profile); + return this; + } + + /** + * Get the provisioningIssues property: The provisioningIssues property. + * + * @return the provisioningIssues value. + */ + public List provisioningIssues() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningIssues(); + } + + /** + * Set the provisioningIssues property: The provisioningIssues property. + * + * @param provisioningIssues the provisioningIssues value to set. + * @return the NetworkSecurityPerimeterConfigurationInner object itself. + */ + public NetworkSecurityPerimeterConfigurationInner + withProvisioningIssues(List provisioningIssues) { + if (this.innerProperties() == null) { + this.innerProperties = new NetworkSecurityPerimeterConfigurationProperties(); + } + this.innerProperties().withProvisioningIssues(provisioningIssues); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/NetworkSecurityPerimeterConfigurationProperties.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/NetworkSecurityPerimeterConfigurationProperties.java new file mode 100644 index 0000000000000..6290270efe5eb --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/NetworkSecurityPerimeterConfigurationProperties.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.search.models.NspConfigAssociation; +import com.azure.resourcemanager.search.models.NspConfigPerimeter; +import com.azure.resourcemanager.search.models.NspConfigProfile; +import com.azure.resourcemanager.search.models.NspProvisioningIssue; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The properties of a network security perimeter configuration. + */ +@Fluent +public final class NetworkSecurityPerimeterConfigurationProperties { + /* + * The provisioningState property. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The perimeter for a network security perimeter configuration. + */ + @JsonProperty(value = "networkSecurityPerimeter") + private NspConfigPerimeter networkSecurityPerimeter; + + /* + * The resource association for the network security perimeter. + */ + @JsonProperty(value = "resourceAssociation") + private NspConfigAssociation resourceAssociation; + + /* + * The profile for a network security perimeter configuration. + */ + @JsonProperty(value = "profile") + private NspConfigProfile profile; + + /* + * The provisioningIssues property. + */ + @JsonProperty(value = "provisioningIssues") + private List provisioningIssues; + + /** + * Creates an instance of NetworkSecurityPerimeterConfigurationProperties class. + */ + public NetworkSecurityPerimeterConfigurationProperties() { + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the networkSecurityPerimeter property: The perimeter for a network security perimeter configuration. + * + * @return the networkSecurityPerimeter value. + */ + public NspConfigPerimeter networkSecurityPerimeter() { + return this.networkSecurityPerimeter; + } + + /** + * Set the networkSecurityPerimeter property: The perimeter for a network security perimeter configuration. + * + * @param networkSecurityPerimeter the networkSecurityPerimeter value to set. + * @return the NetworkSecurityPerimeterConfigurationProperties object itself. + */ + public NetworkSecurityPerimeterConfigurationProperties + withNetworkSecurityPerimeter(NspConfigPerimeter networkSecurityPerimeter) { + this.networkSecurityPerimeter = networkSecurityPerimeter; + return this; + } + + /** + * Get the resourceAssociation property: The resource association for the network security perimeter. + * + * @return the resourceAssociation value. + */ + public NspConfigAssociation resourceAssociation() { + return this.resourceAssociation; + } + + /** + * Set the resourceAssociation property: The resource association for the network security perimeter. + * + * @param resourceAssociation the resourceAssociation value to set. + * @return the NetworkSecurityPerimeterConfigurationProperties object itself. + */ + public NetworkSecurityPerimeterConfigurationProperties + withResourceAssociation(NspConfigAssociation resourceAssociation) { + this.resourceAssociation = resourceAssociation; + return this; + } + + /** + * Get the profile property: The profile for a network security perimeter configuration. + * + * @return the profile value. + */ + public NspConfigProfile profile() { + return this.profile; + } + + /** + * Set the profile property: The profile for a network security perimeter configuration. + * + * @param profile the profile value to set. + * @return the NetworkSecurityPerimeterConfigurationProperties object itself. + */ + public NetworkSecurityPerimeterConfigurationProperties withProfile(NspConfigProfile profile) { + this.profile = profile; + return this; + } + + /** + * Get the provisioningIssues property: The provisioningIssues property. + * + * @return the provisioningIssues value. + */ + public List provisioningIssues() { + return this.provisioningIssues; + } + + /** + * Set the provisioningIssues property: The provisioningIssues property. + * + * @param provisioningIssues the provisioningIssues value to set. + * @return the NetworkSecurityPerimeterConfigurationProperties object itself. + */ + public NetworkSecurityPerimeterConfigurationProperties + withProvisioningIssues(List provisioningIssues) { + this.provisioningIssues = provisioningIssues; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkSecurityPerimeter() != null) { + networkSecurityPerimeter().validate(); + } + if (resourceAssociation() != null) { + resourceAssociation().validate(); + } + if (profile() != null) { + profile().validate(); + } + if (provisioningIssues() != null) { + provisioningIssues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/OperationInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..f75db7f6dcf2e --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/OperationInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.search.models.OperationDisplay; +import com.azure.resourcemanager.search.models.OperationProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a REST API operation. + */ +@Immutable +public final class OperationInner { + /* + * The name of the operation. This name is of the form {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The object that describes the operation. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /* + * Describes if the specified operation is a data plane API operation. Operations where this value is not true are supported directly by the resource provider. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Describes which originating entities are allowed to invoke this operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /* + * Describes additional properties for this operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private OperationProperties properties; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation. This name is of the form {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The object that describes the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the isDataAction property: Describes if the specified operation is a data plane API operation. Operations + * where this value is not true are supported directly by the resource provider. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the origin property: Describes which originating entities are allowed to invoke this operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Get the properties property: Describes additional properties for this operation. + * + * @return the properties value. + */ + public OperationProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateEndpointConnectionInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..0f62467502cd6 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.search.models.PrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes an existing private endpoint connection to the Azure AI Search service. + */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Describes the properties of an existing private endpoint connection to the Azure AI Search service. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties properties; + + /** + * Creates an instance of PrivateEndpointConnectionInner class. + */ + public PrivateEndpointConnectionInner() { + } + + /** + * Get the properties property: Describes the properties of an existing private endpoint connection to the Azure AI + * Search service. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Describes the properties of an existing private endpoint connection to the Azure AI + * Search service. + * + * @param properties the properties value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateLinkResourceInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..2f5f751eaeeab --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.search.models.PrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a supported private link resource for the Azure AI Search service. + */ +@Immutable +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * Describes the properties of a supported private link resource for the Azure AI Search service. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkResourceProperties properties; + + /** + * Creates an instance of PrivateLinkResourceInner class. + */ + public PrivateLinkResourceInner() { + } + + /** + * Get the properties property: Describes the properties of a supported private link resource for the Azure AI + * Search service. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/QueryKeyInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/QueryKeyInner.java new file mode 100644 index 0000000000000..68c14c02c5f36 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/QueryKeyInner.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs collection of + * an index. + */ +@Immutable +public final class QueryKeyInner { + /* + * The name of the query API key. Query names are optional, but assigning a name can help you remember how it's used. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The value of the query API key. + */ + @JsonProperty(value = "key", access = JsonProperty.Access.WRITE_ONLY) + private String key; + + /** + * Creates an instance of QueryKeyInner class. + */ + public QueryKeyInner() { + } + + /** + * Get the name property: The name of the query API key. Query names are optional, but assigning a name can help you + * remember how it's used. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the key property: The value of the query API key. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/QuotaUsageResultInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/QuotaUsageResultInner.java new file mode 100644 index 0000000000000..507b290c9b934 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/QuotaUsageResultInner.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.search.models.QuotaUsageResultName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the quota usage for a particular SKU. + */ +@Fluent +public final class QuotaUsageResultInner { + /* + * The resource ID of the quota usage SKU endpoint for Microsoft.Search provider. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The unit of measurement for the search SKU. + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * The currently used up value for the particular search SKU. + */ + @JsonProperty(value = "currentValue") + private Integer currentValue; + + /* + * The quota limit for the particular search SKU. + */ + @JsonProperty(value = "limit") + private Integer limit; + + /* + * The name of the SKU supported by Azure AI Search. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private QuotaUsageResultName name; + + /** + * Creates an instance of QuotaUsageResultInner class. + */ + public QuotaUsageResultInner() { + } + + /** + * Get the id property: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider. + * + * @param id the id value to set. + * @return the QuotaUsageResultInner object itself. + */ + public QuotaUsageResultInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the unit property: The unit of measurement for the search SKU. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: The unit of measurement for the search SKU. + * + * @param unit the unit value to set. + * @return the QuotaUsageResultInner object itself. + */ + public QuotaUsageResultInner withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the currentValue property: The currently used up value for the particular search SKU. + * + * @return the currentValue value. + */ + public Integer currentValue() { + return this.currentValue; + } + + /** + * Set the currentValue property: The currently used up value for the particular search SKU. + * + * @param currentValue the currentValue value to set. + * @return the QuotaUsageResultInner object itself. + */ + public QuotaUsageResultInner withCurrentValue(Integer currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the limit property: The quota limit for the particular search SKU. + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Set the limit property: The quota limit for the particular search SKU. + * + * @param limit the limit value to set. + * @return the QuotaUsageResultInner object itself. + */ + public QuotaUsageResultInner withLimit(Integer limit) { + this.limit = limit; + return this; + } + + /** + * Get the name property: The name of the SKU supported by Azure AI Search. + * + * @return the name value. + */ + public QuotaUsageResultName name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceInner.java new file mode 100644 index 0000000000000..81f21e9b8c3c8 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceInner.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.search.models.DataPlaneAuthOptions; +import com.azure.resourcemanager.search.models.EncryptionWithCmk; +import com.azure.resourcemanager.search.models.HostingMode; +import com.azure.resourcemanager.search.models.Identity; +import com.azure.resourcemanager.search.models.NetworkRuleSet; +import com.azure.resourcemanager.search.models.ProvisioningState; +import com.azure.resourcemanager.search.models.PublicNetworkAccess; +import com.azure.resourcemanager.search.models.SearchDisabledDataExfiltrationOption; +import com.azure.resourcemanager.search.models.SearchSemanticSearch; +import com.azure.resourcemanager.search.models.SearchServiceStatus; +import com.azure.resourcemanager.search.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * Describes an Azure AI Search service and its current state. + */ +@Fluent +public final class SearchServiceInner extends Resource { + /* + * Properties of the search service. + */ + @JsonProperty(value = "properties") + private SearchServiceProperties innerProperties; + + /* + * The SKU of the search service, which determines price tier and capacity limits. This property is required when creating a new search service. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Creates an instance of SearchServiceInner class. + */ + public SearchServiceInner() { + } + + /** + * Get the innerProperties property: Properties of the search service. + * + * @return the innerProperties value. + */ + private SearchServiceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: The SKU of the search service, which determines price tier and capacity limits. This + * property is required when creating a new search service. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the search service, which determines price tier and capacity limits. This + * property is required when creating a new search service. + * + * @param sku the sku value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SearchServiceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SearchServiceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the replicaCount property: The number of replicas in the search service. If specified, it must be a value + * between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * + * @return the replicaCount value. + */ + public Integer replicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().replicaCount(); + } + + /** + * Set the replicaCount property: The number of replicas in the search service. If specified, it must be a value + * between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * + * @param replicaCount the replicaCount value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withReplicaCount(Integer replicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withReplicaCount(replicaCount); + return this; + } + + /** + * Get the partitionCount property: The number of partitions in the search service; if specified, it can be 1, 2, 3, + * 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode + * set to 'highDensity', the allowed values are between 1 and 3. + * + * @return the partitionCount value. + */ + public Integer partitionCount() { + return this.innerProperties() == null ? null : this.innerProperties().partitionCount(); + } + + /** + * Set the partitionCount property: The number of partitions in the search service; if specified, it can be 1, 2, 3, + * 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode + * set to 'highDensity', the allowed values are between 1 and 3. + * + * @param partitionCount the partitionCount value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withPartitionCount(Integer partitionCount) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withPartitionCount(partitionCount); + return this; + } + + /** + * Get the hostingMode property: Applicable only for the standard3 SKU. You can set this property to enable up to 3 + * high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for + * any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this + * value must be 'default'. + * + * @return the hostingMode value. + */ + public HostingMode hostingMode() { + return this.innerProperties() == null ? null : this.innerProperties().hostingMode(); + } + + /** + * Set the hostingMode property: Applicable only for the standard3 SKU. You can set this property to enable up to 3 + * high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for + * any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this + * value must be 'default'. + * + * @param hostingMode the hostingMode value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withHostingMode(HostingMode hostingMode) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withHostingMode(hostingMode); + return this; + } + + /** + * Get the publicNetworkAccess property: This value can be set to 'enabled' to avoid breaking changes on existing + * customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private + * endpoint connections would be the exclusive access method. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: This value can be set to 'enabled' to avoid breaking changes on existing + * customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private + * endpoint connections would be the exclusive access method. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the status property: The status of the search service. Possible values include: 'running': The search service + * is running and no provisioning operations are underway. 'provisioning': The search service is being provisioned + * or scaled up or down. 'deleting': The search service is being deleted. 'degraded': The search service is + * degraded. This can occur when the underlying search units are not healthy. The search service is most likely + * operational, but performance might be slow and some requests might be dropped. 'disabled': The search service is + * disabled. In this state, the service will reject all API requests. 'error': The search service is in an error + * state. 'stopped': The search service is in a subscription that's disabled. If your service is in the degraded, + * disabled, or error states, it means the Azure AI Search team is actively investigating the underlying issue. + * Dedicated services in these states are still chargeable based on the number of search units provisioned. + * + * @return the status value. + */ + public SearchServiceStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the statusDetails property: The details of the search service status. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.innerProperties() == null ? null : this.innerProperties().statusDetails(); + } + + /** + * Get the provisioningState property: The state of the last provisioning operation performed on the search service. + * Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is + * set up, provisioningState changes to either 'Succeeded' or 'Failed'. Client applications can poll provisioning + * status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service + * operation to see when an operation is completed. If you are using the free service, this value tends to come back + * as 'Succeeded' directly in the call to Create search service. This is because the free service uses capacity that + * is already set up. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the networkRuleSet property: Network specific rules that determine how the Azure AI Search service may be + * reached. + * + * @return the networkRuleSet value. + */ + public NetworkRuleSet networkRuleSet() { + return this.innerProperties() == null ? null : this.innerProperties().networkRuleSet(); + } + + /** + * Set the networkRuleSet property: Network specific rules that determine how the Azure AI Search service may be + * reached. + * + * @param networkRuleSet the networkRuleSet value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withNetworkRuleSet(NetworkRuleSet networkRuleSet) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withNetworkRuleSet(networkRuleSet); + return this; + } + + /** + * Get the disabledDataExfiltrationOptions property: A list of data exfiltration scenarios that are explicitly + * disallowed for the search service. Currently, the only supported value is 'All' to disable all possible data + * export scenarios with more fine grained controls planned for the future. + * + * @return the disabledDataExfiltrationOptions value. + */ + public List disabledDataExfiltrationOptions() { + return this.innerProperties() == null ? null : this.innerProperties().disabledDataExfiltrationOptions(); + } + + /** + * Set the disabledDataExfiltrationOptions property: A list of data exfiltration scenarios that are explicitly + * disallowed for the search service. Currently, the only supported value is 'All' to disable all possible data + * export scenarios with more fine grained controls planned for the future. + * + * @param disabledDataExfiltrationOptions the disabledDataExfiltrationOptions value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withDisabledDataExfiltrationOptions( + List disabledDataExfiltrationOptions) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withDisabledDataExfiltrationOptions(disabledDataExfiltrationOptions); + return this; + } + + /** + * Get the encryptionWithCmk property: Specifies any policy regarding encryption of resources (such as indexes) + * using customer manager keys within a search service. + * + * @return the encryptionWithCmk value. + */ + public EncryptionWithCmk encryptionWithCmk() { + return this.innerProperties() == null ? null : this.innerProperties().encryptionWithCmk(); + } + + /** + * Set the encryptionWithCmk property: Specifies any policy regarding encryption of resources (such as indexes) + * using customer manager keys within a search service. + * + * @param encryptionWithCmk the encryptionWithCmk value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withEncryptionWithCmk(EncryptionWithCmk encryptionWithCmk) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withEncryptionWithCmk(encryptionWithCmk); + return this; + } + + /** + * Get the disableLocalAuth property: 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. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.innerProperties() == null ? null : this.innerProperties().disableLocalAuth(); + } + + /** + * Set the disableLocalAuth property: 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. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withDisableLocalAuth(Boolean disableLocalAuth) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withDisableLocalAuth(disableLocalAuth); + return this; + } + + /** + * Get the authOptions property: 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. + * + * @return the authOptions value. + */ + public DataPlaneAuthOptions authOptions() { + return this.innerProperties() == null ? null : this.innerProperties().authOptions(); + } + + /** + * Set the authOptions property: 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. + * + * @param authOptions the authOptions value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withAuthOptions(DataPlaneAuthOptions authOptions) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withAuthOptions(authOptions); + return this; + } + + /** + * Get the semanticSearch property: Sets options that control the availability of semantic search. This + * configuration is only possible for certain Azure AI Search SKUs in certain locations. + * + * @return the semanticSearch value. + */ + public SearchSemanticSearch semanticSearch() { + return this.innerProperties() == null ? null : this.innerProperties().semanticSearch(); + } + + /** + * Set the semanticSearch property: Sets options that control the availability of semantic search. This + * configuration is only possible for certain Azure AI Search SKUs in certain locations. + * + * @param semanticSearch the semanticSearch value to set. + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withSemanticSearch(SearchSemanticSearch semanticSearch) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withSemanticSearch(semanticSearch); + return this; + } + + /** + * Get the privateEndpointConnections property: The list of private endpoint connections to the Azure AI Search + * service. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the sharedPrivateLinkResources property: The list of shared private link resources managed by the Azure AI + * Search service. + * + * @return the sharedPrivateLinkResources value. + */ + public List sharedPrivateLinkResources() { + return this.innerProperties() == null ? null : this.innerProperties().sharedPrivateLinkResources(); + } + + /** + * Get the etag property: A system generated property representing the service's etag that can be for optimistic + * concurrency control during updates. + * + * @return the etag value. + */ + public String etag() { + return this.innerProperties() == null ? null : this.innerProperties().etag(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceProperties.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceProperties.java new file mode 100644 index 0000000000000..1b96306a8d660 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceProperties.java @@ -0,0 +1,451 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.search.models.DataPlaneAuthOptions; +import com.azure.resourcemanager.search.models.EncryptionWithCmk; +import com.azure.resourcemanager.search.models.HostingMode; +import com.azure.resourcemanager.search.models.NetworkRuleSet; +import com.azure.resourcemanager.search.models.ProvisioningState; +import com.azure.resourcemanager.search.models.PublicNetworkAccess; +import com.azure.resourcemanager.search.models.SearchDisabledDataExfiltrationOption; +import com.azure.resourcemanager.search.models.SearchSemanticSearch; +import com.azure.resourcemanager.search.models.SearchServiceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Properties of the search service. + */ +@Fluent +public final class SearchServiceProperties { + /* + * The number of replicas in the search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + */ + @JsonProperty(value = "replicaCount") + private Integer replicaCount; + + /* + * The number of partitions in the search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. + */ + @JsonProperty(value = "partitionCount") + private Integer partitionCount; + + /* + * Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. + */ + @JsonProperty(value = "hostingMode") + private HostingMode hostingMode; + + /* + * This value can be set to 'enabled' to avoid breaking changes on existing customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private endpoint connections would be the exclusive access method. + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * The status of the search service. Possible values include: 'running': The search service is running and no provisioning operations are underway. 'provisioning': The search service is being provisioned or scaled up or down. 'deleting': The search service is being deleted. 'degraded': The search service is degraded. This can occur when the underlying search units are not healthy. The search service is most likely operational, but performance might be slow and some requests might be dropped. 'disabled': The search service is disabled. In this state, the service will reject all API requests. 'error': The search service is in an error state. 'stopped': The search service is in a subscription that's disabled. If your service is in the degraded, disabled, or error states, it means the Azure AI Search team is actively investigating the underlying issue. Dedicated services in these states are still chargeable based on the number of search units provisioned. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private SearchServiceStatus status; + + /* + * The details of the search service status. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * The state of the last provisioning operation performed on the search service. Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is set up, provisioningState changes to either 'Succeeded' or 'Failed'. Client applications can poll provisioning status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service operation to see when an operation is completed. If you are using the free service, this value tends to come back as 'Succeeded' directly in the call to Create search service. This is because the free service uses capacity that is already set up. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Network specific rules that determine how the Azure AI Search service may be reached. + */ + @JsonProperty(value = "networkRuleSet") + private NetworkRuleSet networkRuleSet; + + /* + * A list of data exfiltration scenarios that are explicitly disallowed for the search service. Currently, the only supported value is 'All' to disable all possible data export scenarios with more fine grained controls planned for the future. + */ + @JsonProperty(value = "disabledDataExfiltrationOptions") + private List disabledDataExfiltrationOptions; + + /* + * Specifies any policy regarding encryption of resources (such as indexes) using customer manager keys within a search service. + */ + @JsonProperty(value = "encryptionWithCmk") + private EncryptionWithCmk encryptionWithCmk; + + /* + * 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. + */ + @JsonProperty(value = "disableLocalAuth") + private Boolean disableLocalAuth; + + /* + * 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. + */ + @JsonProperty(value = "authOptions") + private DataPlaneAuthOptions authOptions; + + /* + * Sets options that control the availability of semantic search. This configuration is only possible for certain Azure AI Search SKUs in certain locations. + */ + @JsonProperty(value = "semanticSearch") + private SearchSemanticSearch semanticSearch; + + /* + * The list of private endpoint connections to the Azure AI Search service. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * The list of shared private link resources managed by the Azure AI Search service. + */ + @JsonProperty(value = "sharedPrivateLinkResources", access = JsonProperty.Access.WRITE_ONLY) + private List sharedPrivateLinkResources; + + /* + * A system generated property representing the service's etag that can be for optimistic concurrency control during updates. + */ + @JsonProperty(value = "eTag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Creates an instance of SearchServiceProperties class. + */ + public SearchServiceProperties() { + } + + /** + * Get the replicaCount property: The number of replicas in the search service. If specified, it must be a value + * between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * + * @return the replicaCount value. + */ + public Integer replicaCount() { + return this.replicaCount; + } + + /** + * Set the replicaCount property: The number of replicas in the search service. If specified, it must be a value + * between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * + * @param replicaCount the replicaCount value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withReplicaCount(Integer replicaCount) { + this.replicaCount = replicaCount; + return this; + } + + /** + * Get the partitionCount property: The number of partitions in the search service; if specified, it can be 1, 2, 3, + * 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode + * set to 'highDensity', the allowed values are between 1 and 3. + * + * @return the partitionCount value. + */ + public Integer partitionCount() { + return this.partitionCount; + } + + /** + * Set the partitionCount property: The number of partitions in the search service; if specified, it can be 1, 2, 3, + * 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode + * set to 'highDensity', the allowed values are between 1 and 3. + * + * @param partitionCount the partitionCount value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withPartitionCount(Integer partitionCount) { + this.partitionCount = partitionCount; + return this; + } + + /** + * Get the hostingMode property: Applicable only for the standard3 SKU. You can set this property to enable up to 3 + * high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for + * any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this + * value must be 'default'. + * + * @return the hostingMode value. + */ + public HostingMode hostingMode() { + return this.hostingMode; + } + + /** + * Set the hostingMode property: Applicable only for the standard3 SKU. You can set this property to enable up to 3 + * high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for + * any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this + * value must be 'default'. + * + * @param hostingMode the hostingMode value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withHostingMode(HostingMode hostingMode) { + this.hostingMode = hostingMode; + return this; + } + + /** + * Get the publicNetworkAccess property: This value can be set to 'enabled' to avoid breaking changes on existing + * customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private + * endpoint connections would be the exclusive access method. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: This value can be set to 'enabled' to avoid breaking changes on existing + * customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private + * endpoint connections would be the exclusive access method. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the status property: The status of the search service. Possible values include: 'running': The search service + * is running and no provisioning operations are underway. 'provisioning': The search service is being provisioned + * or scaled up or down. 'deleting': The search service is being deleted. 'degraded': The search service is + * degraded. This can occur when the underlying search units are not healthy. The search service is most likely + * operational, but performance might be slow and some requests might be dropped. 'disabled': The search service is + * disabled. In this state, the service will reject all API requests. 'error': The search service is in an error + * state. 'stopped': The search service is in a subscription that's disabled. If your service is in the degraded, + * disabled, or error states, it means the Azure AI Search team is actively investigating the underlying issue. + * Dedicated services in these states are still chargeable based on the number of search units provisioned. + * + * @return the status value. + */ + public SearchServiceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: The details of the search service status. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the provisioningState property: The state of the last provisioning operation performed on the search service. + * Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is + * set up, provisioningState changes to either 'Succeeded' or 'Failed'. Client applications can poll provisioning + * status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service + * operation to see when an operation is completed. If you are using the free service, this value tends to come back + * as 'Succeeded' directly in the call to Create search service. This is because the free service uses capacity that + * is already set up. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the networkRuleSet property: Network specific rules that determine how the Azure AI Search service may be + * reached. + * + * @return the networkRuleSet value. + */ + public NetworkRuleSet networkRuleSet() { + return this.networkRuleSet; + } + + /** + * Set the networkRuleSet property: Network specific rules that determine how the Azure AI Search service may be + * reached. + * + * @param networkRuleSet the networkRuleSet value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withNetworkRuleSet(NetworkRuleSet networkRuleSet) { + this.networkRuleSet = networkRuleSet; + return this; + } + + /** + * Get the disabledDataExfiltrationOptions property: A list of data exfiltration scenarios that are explicitly + * disallowed for the search service. Currently, the only supported value is 'All' to disable all possible data + * export scenarios with more fine grained controls planned for the future. + * + * @return the disabledDataExfiltrationOptions value. + */ + public List disabledDataExfiltrationOptions() { + return this.disabledDataExfiltrationOptions; + } + + /** + * Set the disabledDataExfiltrationOptions property: A list of data exfiltration scenarios that are explicitly + * disallowed for the search service. Currently, the only supported value is 'All' to disable all possible data + * export scenarios with more fine grained controls planned for the future. + * + * @param disabledDataExfiltrationOptions the disabledDataExfiltrationOptions value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withDisabledDataExfiltrationOptions( + List disabledDataExfiltrationOptions) { + this.disabledDataExfiltrationOptions = disabledDataExfiltrationOptions; + return this; + } + + /** + * Get the encryptionWithCmk property: Specifies any policy regarding encryption of resources (such as indexes) + * using customer manager keys within a search service. + * + * @return the encryptionWithCmk value. + */ + public EncryptionWithCmk encryptionWithCmk() { + return this.encryptionWithCmk; + } + + /** + * Set the encryptionWithCmk property: Specifies any policy regarding encryption of resources (such as indexes) + * using customer manager keys within a search service. + * + * @param encryptionWithCmk the encryptionWithCmk value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withEncryptionWithCmk(EncryptionWithCmk encryptionWithCmk) { + this.encryptionWithCmk = encryptionWithCmk; + return this; + } + + /** + * Get the disableLocalAuth property: 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. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.disableLocalAuth; + } + + /** + * Set the disableLocalAuth property: 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. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withDisableLocalAuth(Boolean disableLocalAuth) { + this.disableLocalAuth = disableLocalAuth; + return this; + } + + /** + * Get the authOptions property: 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. + * + * @return the authOptions value. + */ + public DataPlaneAuthOptions authOptions() { + return this.authOptions; + } + + /** + * Set the authOptions property: 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. + * + * @param authOptions the authOptions value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withAuthOptions(DataPlaneAuthOptions authOptions) { + this.authOptions = authOptions; + return this; + } + + /** + * Get the semanticSearch property: Sets options that control the availability of semantic search. This + * configuration is only possible for certain Azure AI Search SKUs in certain locations. + * + * @return the semanticSearch value. + */ + public SearchSemanticSearch semanticSearch() { + return this.semanticSearch; + } + + /** + * Set the semanticSearch property: Sets options that control the availability of semantic search. This + * configuration is only possible for certain Azure AI Search SKUs in certain locations. + * + * @param semanticSearch the semanticSearch value to set. + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withSemanticSearch(SearchSemanticSearch semanticSearch) { + this.semanticSearch = semanticSearch; + return this; + } + + /** + * Get the privateEndpointConnections property: The list of private endpoint connections to the Azure AI Search + * service. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the sharedPrivateLinkResources property: The list of shared private link resources managed by the Azure AI + * Search service. + * + * @return the sharedPrivateLinkResources value. + */ + public List sharedPrivateLinkResources() { + return this.sharedPrivateLinkResources; + } + + /** + * Get the etag property: A system generated property representing the service's etag that can be for optimistic + * concurrency control during updates. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkRuleSet() != null) { + networkRuleSet().validate(); + } + if (encryptionWithCmk() != null) { + encryptionWithCmk().validate(); + } + if (authOptions() != null) { + authOptions().validate(); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (sharedPrivateLinkResources() != null) { + sharedPrivateLinkResources().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SharedPrivateLinkResourceInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SharedPrivateLinkResourceInner.java new file mode 100644 index 0000000000000..df287d4438861 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SharedPrivateLinkResourceInner.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a shared private link resource managed by the Azure AI Search service. + */ +@Fluent +public final class SharedPrivateLinkResourceInner extends ProxyResource { + /* + * Describes the properties of a shared private link resource managed by the Azure AI Search service. + */ + @JsonProperty(value = "properties") + private SharedPrivateLinkResourceProperties properties; + + /** + * Creates an instance of SharedPrivateLinkResourceInner class. + */ + public SharedPrivateLinkResourceInner() { + } + + /** + * Get the properties property: Describes the properties of a shared private link resource managed by the Azure AI + * Search service. + * + * @return the properties value. + */ + public SharedPrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Describes the properties of a shared private link resource managed by the Azure AI + * Search service. + * + * @param properties the properties value to set. + * @return the SharedPrivateLinkResourceInner object itself. + */ + public SharedPrivateLinkResourceInner withProperties(SharedPrivateLinkResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/package-info.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/package-info.java new file mode 100644 index 0000000000000..870fa62ebe9fb --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for SearchManagementClient. + * Client that can be used to manage Azure AI Search services and API keys. + */ +package com.azure.resourcemanager.search.fluent.models; diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/package-info.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/package-info.java new file mode 100644 index 0000000000000..8b93a05b1fde7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for SearchManagementClient. + * Client that can be used to manage Azure AI Search services and API keys. + */ +package com.azure.resourcemanager.search.fluent; diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeyResultImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeyResultImpl.java new file mode 100644 index 0000000000000..6b4f9315b9ab4 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeyResultImpl.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.resourcemanager.search.fluent.models.AdminKeyResultInner; +import com.azure.resourcemanager.search.models.AdminKeyResult; + +public final class AdminKeyResultImpl implements AdminKeyResult { + private AdminKeyResultInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + AdminKeyResultImpl(AdminKeyResultInner innerObject, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primaryKey() { + return this.innerModel().primaryKey(); + } + + public String secondaryKey() { + return this.innerModel().secondaryKey(); + } + + public AdminKeyResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysClientImpl.java new file mode 100644 index 0000000000000..390cbe67b3fec --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysClientImpl.java @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.search.fluent.AdminKeysClient; +import com.azure.resourcemanager.search.fluent.models.AdminKeyResultInner; +import com.azure.resourcemanager.search.models.AdminKeyKind; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AdminKeysClient. + */ +public final class AdminKeysClientImpl implements AdminKeysClient { + /** + * The proxy service used to perform REST calls. + */ + private final AdminKeysService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of AdminKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AdminKeysClientImpl(SearchManagementClientImpl client) { + this.service + = RestProxy.create(AdminKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientAdminKeys to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface AdminKeysService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> regenerate(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, @PathParam("keyKind") AdminKeyKind keyKind, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the primary and secondary admin API keys for the specified Azure AI Search service along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String searchServiceName, + UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, searchServiceName, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the primary and secondary admin API keys for the specified Azure AI Search service along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), resourceGroupName, searchServiceName, clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the primary and secondary admin API keys for the specified Azure AI Search service on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return getWithResponseAsync(resourceGroupName, searchServiceName, clientRequestId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the primary and secondary admin API keys for the specified Azure AI Search service along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + return getWithResponseAsync(resourceGroupName, searchServiceName, clientRequestId, context).block(); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the primary and secondary admin API keys for the specified Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdminKeyResultInner get(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return getWithResponse(resourceGroupName, searchServiceName, clientRequestId, Context.NONE).getValue(); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the primary and secondary admin API keys for a given Azure AI Search service along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateWithResponseAsync(String resourceGroupName, + String searchServiceName, AdminKeyKind keyKind, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (keyKind == null) { + return Mono.error(new IllegalArgumentException("Parameter keyKind is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.regenerate(this.client.getEndpoint(), resourceGroupName, searchServiceName, keyKind, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the primary and secondary admin API keys for a given Azure AI Search service along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateWithResponseAsync(String resourceGroupName, + String searchServiceName, AdminKeyKind keyKind, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (keyKind == null) { + return Mono.error(new IllegalArgumentException("Parameter keyKind is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.regenerate(this.client.getEndpoint(), resourceGroupName, searchServiceName, keyKind, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the primary and secondary admin API keys for a given Azure AI Search service on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateAsync(String resourceGroupName, String searchServiceName, + AdminKeyKind keyKind) { + final UUID clientRequestId = null; + return regenerateWithResponseAsync(resourceGroupName, searchServiceName, keyKind, clientRequestId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the primary and secondary admin API keys for a given Azure AI Search service along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response regenerateWithResponse(String resourceGroupName, String searchServiceName, + AdminKeyKind keyKind, UUID clientRequestId, Context context) { + return regenerateWithResponseAsync(resourceGroupName, searchServiceName, keyKind, clientRequestId, context) + .block(); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the primary and secondary admin API keys for a given Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdminKeyResultInner regenerate(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind) { + final UUID clientRequestId = null; + return regenerateWithResponse(resourceGroupName, searchServiceName, keyKind, clientRequestId, Context.NONE) + .getValue(); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysImpl.java new file mode 100644 index 0000000000000..3aaccfd5f7a9d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysImpl.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.AdminKeysClient; +import com.azure.resourcemanager.search.fluent.models.AdminKeyResultInner; +import com.azure.resourcemanager.search.models.AdminKeyKind; +import com.azure.resourcemanager.search.models.AdminKeyResult; +import com.azure.resourcemanager.search.models.AdminKeys; +import java.util.UUID; + +public final class AdminKeysImpl implements AdminKeys { + private static final ClientLogger LOGGER = new ClientLogger(AdminKeysImpl.class); + + private final AdminKeysClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public AdminKeysImpl(AdminKeysClient innerClient, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, searchServiceName, clientRequestId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AdminKeyResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AdminKeyResult get(String resourceGroupName, String searchServiceName) { + AdminKeyResultInner inner = this.serviceClient().get(resourceGroupName, searchServiceName); + if (inner != null) { + return new AdminKeyResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response regenerateWithResponse(String resourceGroupName, String searchServiceName, + AdminKeyKind keyKind, UUID clientRequestId, Context context) { + Response inner = this.serviceClient() + .regenerateWithResponse(resourceGroupName, searchServiceName, keyKind, clientRequestId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AdminKeyResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AdminKeyResult regenerate(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind) { + AdminKeyResultInner inner = this.serviceClient().regenerate(resourceGroupName, searchServiceName, keyKind); + if (inner != null) { + return new AdminKeyResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private AdminKeysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/CheckNameAvailabilityOutputImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/CheckNameAvailabilityOutputImpl.java new file mode 100644 index 0000000000000..fd7ed43a67901 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/CheckNameAvailabilityOutputImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.resourcemanager.search.fluent.models.CheckNameAvailabilityOutputInner; +import com.azure.resourcemanager.search.models.CheckNameAvailabilityOutput; +import com.azure.resourcemanager.search.models.UnavailableNameReason; + +public final class CheckNameAvailabilityOutputImpl implements CheckNameAvailabilityOutput { + private CheckNameAvailabilityOutputInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + CheckNameAvailabilityOutputImpl(CheckNameAvailabilityOutputInner innerObject, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean isNameAvailable() { + return this.innerModel().isNameAvailable(); + } + + public UnavailableNameReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityOutputInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/NetworkSecurityPerimeterConfigurationImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/NetworkSecurityPerimeterConfigurationImpl.java new file mode 100644 index 0000000000000..cd489b0c87e8b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/NetworkSecurityPerimeterConfigurationImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.resourcemanager.search.fluent.models.NetworkSecurityPerimeterConfigurationInner; +import com.azure.resourcemanager.search.models.NetworkSecurityPerimeterConfiguration; +import com.azure.resourcemanager.search.models.NspConfigAssociation; +import com.azure.resourcemanager.search.models.NspConfigPerimeter; +import com.azure.resourcemanager.search.models.NspConfigProfile; +import com.azure.resourcemanager.search.models.NspProvisioningIssue; +import java.util.Collections; +import java.util.List; + +public final class NetworkSecurityPerimeterConfigurationImpl implements NetworkSecurityPerimeterConfiguration { + private NetworkSecurityPerimeterConfigurationInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + NetworkSecurityPerimeterConfigurationImpl(NetworkSecurityPerimeterConfigurationInner innerObject, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public NspConfigPerimeter networkSecurityPerimeter() { + return this.innerModel().networkSecurityPerimeter(); + } + + public NspConfigAssociation resourceAssociation() { + return this.innerModel().resourceAssociation(); + } + + public NspConfigProfile profile() { + return this.innerModel().profile(); + } + + public List provisioningIssues() { + List inner = this.innerModel().provisioningIssues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public NetworkSecurityPerimeterConfigurationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/NetworkSecurityPerimeterConfigurationsClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/NetworkSecurityPerimeterConfigurationsClientImpl.java new file mode 100644 index 0000000000000..eb54e67d51774 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/NetworkSecurityPerimeterConfigurationsClientImpl.java @@ -0,0 +1,724 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.search.fluent.NetworkSecurityPerimeterConfigurationsClient; +import com.azure.resourcemanager.search.fluent.models.NetworkSecurityPerimeterConfigurationInner; +import com.azure.resourcemanager.search.models.NetworkSecurityPerimeterConfigurationListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * NetworkSecurityPerimeterConfigurationsClient. + */ +public final class NetworkSecurityPerimeterConfigurationsClientImpl + implements NetworkSecurityPerimeterConfigurationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final NetworkSecurityPerimeterConfigurationsService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of NetworkSecurityPerimeterConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NetworkSecurityPerimeterConfigurationsClientImpl(SearchManagementClientImpl client) { + this.service = RestProxy.create(NetworkSecurityPerimeterConfigurationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientNetworkSecurityPerimeterConfigurations to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface NetworkSecurityPerimeterConfigurationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByService( + @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations/{nspConfigName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, @PathParam("nspConfigName") String nspConfigName, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations/{nspConfigName}/reconcile") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> reconcile(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, @PathParam("nspConfigName") String nspConfigName, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServiceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByServiceSinglePageAsync(String resourceGroupName, String searchServiceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByService(this.client.getEndpoint(), resourceGroupName, + searchServiceName, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByServiceSinglePageAsync(String resourceGroupName, String searchServiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByService(this.client.getEndpoint(), resourceGroupName, searchServiceName, + this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceAsync(String resourceGroupName, + String searchServiceName) { + return new PagedFlux<>(() -> listByServiceSinglePageAsync(resourceGroupName, searchServiceName), + nextLink -> listByServiceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceAsync(String resourceGroupName, + String searchServiceName, Context context) { + return new PagedFlux<>(() -> listByServiceSinglePageAsync(resourceGroupName, searchServiceName, context), + nextLink -> listByServiceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByService(String resourceGroupName, + String searchServiceName) { + return new PagedIterable<>(listByServiceAsync(resourceGroupName, searchServiceName)); + } + + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByService(String resourceGroupName, + String searchServiceName, Context context) { + return new PagedIterable<>(listByServiceAsync(resourceGroupName, searchServiceName, context)); + } + + /** + * Gets a network security perimeter configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a network security perimeter configuration along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String searchServiceName, String nspConfigName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (nspConfigName == null) { + return Mono.error(new IllegalArgumentException("Parameter nspConfigName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, searchServiceName, + nspConfigName, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a network security perimeter configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a network security perimeter configuration along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String searchServiceName, String nspConfigName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (nspConfigName == null) { + return Mono.error(new IllegalArgumentException("Parameter nspConfigName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), resourceGroupName, searchServiceName, nspConfigName, + this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context); + } + + /** + * Gets a network security perimeter configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a network security perimeter configuration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, + String searchServiceName, String nspConfigName) { + return getWithResponseAsync(resourceGroupName, searchServiceName, nspConfigName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a network security perimeter configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a network security perimeter configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String searchServiceName, String nspConfigName, Context context) { + return getWithResponseAsync(resourceGroupName, searchServiceName, nspConfigName, context).block(); + } + + /** + * Gets a network security perimeter configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a network security perimeter configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkSecurityPerimeterConfigurationInner get(String resourceGroupName, String searchServiceName, + String nspConfigName) { + return getWithResponse(resourceGroupName, searchServiceName, nspConfigName, Context.NONE).getValue(); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> reconcileWithResponseAsync(String resourceGroupName, + String searchServiceName, String nspConfigName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (nspConfigName == null) { + return Mono.error(new IllegalArgumentException("Parameter nspConfigName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.reconcile(this.client.getEndpoint(), resourceGroupName, searchServiceName, + nspConfigName, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> reconcileWithResponseAsync(String resourceGroupName, + String searchServiceName, String nspConfigName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (nspConfigName == null) { + return Mono.error(new IllegalArgumentException("Parameter nspConfigName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.reconcile(this.client.getEndpoint(), resourceGroupName, searchServiceName, nspConfigName, + this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReconcileAsync(String resourceGroupName, String searchServiceName, + String nspConfigName) { + Mono>> mono + = reconcileWithResponseAsync(resourceGroupName, searchServiceName, nspConfigName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginReconcileAsync(String resourceGroupName, String searchServiceName, + String nspConfigName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = reconcileWithResponseAsync(resourceGroupName, searchServiceName, nspConfigName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReconcile(String resourceGroupName, String searchServiceName, + String nspConfigName) { + return this.beginReconcileAsync(resourceGroupName, searchServiceName, nspConfigName).getSyncPoller(); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginReconcile(String resourceGroupName, String searchServiceName, + String nspConfigName, Context context) { + return this.beginReconcileAsync(resourceGroupName, searchServiceName, nspConfigName, context).getSyncPoller(); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono reconcileAsync(String resourceGroupName, String searchServiceName, String nspConfigName) { + return beginReconcileAsync(resourceGroupName, searchServiceName, nspConfigName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono reconcileAsync(String resourceGroupName, String searchServiceName, String nspConfigName, + Context context) { + return beginReconcileAsync(resourceGroupName, searchServiceName, nspConfigName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void reconcile(String resourceGroupName, String searchServiceName, String nspConfigName) { + reconcileAsync(resourceGroupName, searchServiceName, nspConfigName).block(); + } + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void reconcile(String resourceGroupName, String searchServiceName, String nspConfigName, Context context) { + reconcileAsync(resourceGroupName, searchServiceName, nspConfigName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a server along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByServiceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServiceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a server along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByServiceNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByServiceNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/NetworkSecurityPerimeterConfigurationsImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/NetworkSecurityPerimeterConfigurationsImpl.java new file mode 100644 index 0000000000000..99f4153bb2554 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/NetworkSecurityPerimeterConfigurationsImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.NetworkSecurityPerimeterConfigurationsClient; +import com.azure.resourcemanager.search.fluent.models.NetworkSecurityPerimeterConfigurationInner; +import com.azure.resourcemanager.search.models.NetworkSecurityPerimeterConfiguration; +import com.azure.resourcemanager.search.models.NetworkSecurityPerimeterConfigurations; + +public final class NetworkSecurityPerimeterConfigurationsImpl implements NetworkSecurityPerimeterConfigurations { + private static final ClientLogger LOGGER = new ClientLogger(NetworkSecurityPerimeterConfigurationsImpl.class); + + private final NetworkSecurityPerimeterConfigurationsClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public NetworkSecurityPerimeterConfigurationsImpl(NetworkSecurityPerimeterConfigurationsClient innerClient, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByService(String resourceGroupName, + String searchServiceName) { + PagedIterable inner + = this.serviceClient().listByService(resourceGroupName, searchServiceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new NetworkSecurityPerimeterConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable listByService(String resourceGroupName, + String searchServiceName, Context context) { + PagedIterable inner + = this.serviceClient().listByService(resourceGroupName, searchServiceName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new NetworkSecurityPerimeterConfigurationImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, + String searchServiceName, String nspConfigName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, searchServiceName, nspConfigName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new NetworkSecurityPerimeterConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NetworkSecurityPerimeterConfiguration get(String resourceGroupName, String searchServiceName, + String nspConfigName) { + NetworkSecurityPerimeterConfigurationInner inner + = this.serviceClient().get(resourceGroupName, searchServiceName, nspConfigName); + if (inner != null) { + return new NetworkSecurityPerimeterConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public void reconcile(String resourceGroupName, String searchServiceName, String nspConfigName) { + this.serviceClient().reconcile(resourceGroupName, searchServiceName, nspConfigName); + } + + public void reconcile(String resourceGroupName, String searchServiceName, String nspConfigName, Context context) { + this.serviceClient().reconcile(resourceGroupName, searchServiceName, nspConfigName, context); + } + + private NetworkSecurityPerimeterConfigurationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationImpl.java new file mode 100644 index 0000000000000..5b4e9f4a31a89 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.resourcemanager.search.fluent.models.OperationInner; +import com.azure.resourcemanager.search.models.Operation; +import com.azure.resourcemanager.search.models.OperationDisplay; +import com.azure.resourcemanager.search.models.OperationProperties; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public OperationProperties properties() { + return this.innerModel().properties(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..017767af489ea --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsClientImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.search.fluent.OperationsClient; +import com.azure.resourcemanager.search.fluent.models.OperationInner; +import com.azure.resourcemanager.search.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(SearchManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Search/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), null, null)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..d6493a994d1ae --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.OperationsClient; +import com.azure.resourcemanager.search.fluent.models.OperationInner; +import com.azure.resourcemanager.search.models.Operation; +import com.azure.resourcemanager.search.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..328c4e7b1739c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.search.models.PrivateEndpointConnection; +import com.azure.resourcemanager.search.models.PrivateEndpointConnectionProperties; + +public final class PrivateEndpointConnectionImpl implements PrivateEndpointConnection { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointConnectionProperties properties() { + return this.innerModel().properties(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..88e7625725d50 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,883 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.search.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.search.models.PrivateEndpointConnectionListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. + */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateEndpointConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(SearchManagementClientImpl client) { + this.service = RestProxy.create(PrivateEndpointConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientPrivateEndpointConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface PrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") PrivateEndpointConnectionInner privateEndpointConnection, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 404 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByService(@HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServiceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Updates a private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param privateEndpointConnection The definition of the private endpoint connection to update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String searchServiceName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono.error( + new IllegalArgumentException("Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), resourceGroupName, searchServiceName, + privateEndpointConnectionName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), privateEndpointConnection, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param privateEndpointConnection The definition of the private endpoint connection to update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String searchServiceName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (privateEndpointConnection == null) { + return Mono.error( + new IllegalArgumentException("Parameter privateEndpointConnection is required and cannot be null.")); + } else { + privateEndpointConnection.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), resourceGroupName, searchServiceName, + privateEndpointConnectionName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), privateEndpointConnection, accept, context); + } + + /** + * Updates a private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param privateEndpointConnection The definition of the private endpoint connection to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { + final UUID clientRequestId = null; + return updateWithResponseAsync(resourceGroupName, searchServiceName, privateEndpointConnectionName, + privateEndpointConnection, clientRequestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param privateEndpointConnection The definition of the private endpoint connection to update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, + String searchServiceName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, UUID clientRequestId, Context context) { + return updateWithResponseAsync(resourceGroupName, searchServiceName, privateEndpointConnectionName, + privateEndpointConnection, clientRequestId, context).block(); + } + + /** + * Updates a private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param privateEndpointConnection The definition of the private endpoint connection to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner update(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { + final UUID clientRequestId = null; + return updateWithResponse(resourceGroupName, searchServiceName, privateEndpointConnectionName, + privateEndpointConnection, clientRequestId, Context.NONE).getValue(); + } + + /** + * Gets the details of the private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the private endpoint connection to the search service in the given resource group along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String searchServiceName, String privateEndpointConnectionName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, searchServiceName, + privateEndpointConnectionName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the details of the private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the private endpoint connection to the search service in the given resource group along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String searchServiceName, String privateEndpointConnectionName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), resourceGroupName, searchServiceName, + privateEndpointConnectionName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + } + + /** + * Gets the details of the private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the private endpoint connection to the search service in the given resource group on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName) { + final UUID clientRequestId = null; + return getWithResponseAsync(resourceGroupName, searchServiceName, privateEndpointConnectionName, + clientRequestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the details of the private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the private endpoint connection to the search service in the given resource group along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, UUID clientRequestId, Context context) { + return getWithResponseAsync(resourceGroupName, searchServiceName, privateEndpointConnectionName, + clientRequestId, context).block(); + } + + /** + * Gets the details of the private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the private endpoint connection to the search service in the given resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName) { + final UUID clientRequestId = null; + return getWithResponse(resourceGroupName, searchServiceName, privateEndpointConnectionName, clientRequestId, + Context.NONE).getValue(); + } + + /** + * Disconnects the private endpoint connection and deletes it from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, + String searchServiceName, String privateEndpointConnectionName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, searchServiceName, + privateEndpointConnectionName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disconnects the private endpoint connection and deletes it from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, + String searchServiceName, String privateEndpointConnectionName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), resourceGroupName, searchServiceName, + privateEndpointConnectionName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + } + + /** + * Disconnects the private endpoint connection and deletes it from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName) { + final UUID clientRequestId = null; + return deleteWithResponseAsync(resourceGroupName, searchServiceName, privateEndpointConnectionName, + clientRequestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Disconnects the private endpoint connection and deletes it from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, + String searchServiceName, String privateEndpointConnectionName, UUID clientRequestId, Context context) { + return deleteWithResponseAsync(resourceGroupName, searchServiceName, privateEndpointConnectionName, + clientRequestId, context).block(); + } + + /** + * Disconnects the private endpoint connection and deletes it from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner delete(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName) { + final UUID clientRequestId = null; + return deleteWithResponse(resourceGroupName, searchServiceName, privateEndpointConnectionName, clientRequestId, + Context.NONE).getValue(); + } + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServiceSinglePageAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByService(this.client.getEndpoint(), clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, searchServiceName, + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServiceSinglePageAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByService(this.client.getEndpoint(), clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, searchServiceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId) { + return new PagedFlux<>( + () -> listByServiceSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId), + nextLink -> listByServiceNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceAsync(String resourceGroupName, + String searchServiceName) { + final UUID clientRequestId = null; + return new PagedFlux<>( + () -> listByServiceSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId), + nextLink -> listByServiceNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + return new PagedFlux<>( + () -> listByServiceSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId, context), + nextLink -> listByServiceNextSinglePageAsync(nextLink, clientRequestId, context)); + } + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByService(String resourceGroupName, + String searchServiceName) { + final UUID clientRequestId = null; + return new PagedIterable<>(listByServiceAsync(resourceGroupName, searchServiceName, clientRequestId)); + } + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByService(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + return new PagedIterable<>(listByServiceAsync(resourceGroupName, searchServiceName, clientRequestId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing a list of private endpoint connections along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServiceNextSinglePageAsync(String nextLink, + UUID clientRequestId) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listByServiceNext(nextLink, this.client.getEndpoint(), clientRequestId, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing a list of private endpoint connections along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServiceNextSinglePageAsync(String nextLink, + UUID clientRequestId, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByServiceNext(nextLink, this.client.getEndpoint(), clientRequestId, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..83b65fb20f960 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.search.models.PrivateEndpointConnection; +import com.azure.resourcemanager.search.models.PrivateEndpointConnections; +import java.util.UUID; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response updateWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, + UUID clientRequestId, Context context) { + Response inner = this.serviceClient() + .updateWithResponse(resourceGroupName, searchServiceName, privateEndpointConnectionName, + privateEndpointConnection, clientRequestId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection update(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { + PrivateEndpointConnectionInner inner = this.serviceClient() + .update(resourceGroupName, searchServiceName, privateEndpointConnectionName, privateEndpointConnection); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, UUID clientRequestId, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, searchServiceName, privateEndpointConnectionName, clientRequestId, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection get(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner + = this.serviceClient().get(resourceGroupName, searchServiceName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, UUID clientRequestId, Context context) { + Response inner = this.serviceClient() + .deleteWithResponse(resourceGroupName, searchServiceName, privateEndpointConnectionName, clientRequestId, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection delete(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner + = this.serviceClient().delete(resourceGroupName, searchServiceName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByService(String resourceGroupName, String searchServiceName) { + PagedIterable inner + = this.serviceClient().listByService(resourceGroupName, searchServiceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + PagedIterable inner + = this.serviceClient().listByService(resourceGroupName, searchServiceName, clientRequestId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourceImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..fd4611fcc21c2 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.resourcemanager.search.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.search.models.PrivateLinkResource; +import com.azure.resourcemanager.search.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..9b7a7752ce1c4 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.search.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.search.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.search.models.PrivateLinkResourcesResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(SearchManagementClientImpl client) { + this.service = RestProxy.create(PrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface PrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSupported(@HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSupportedSinglePageAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listSupported(this.client.getEndpoint(), clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, searchServiceName, + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSupportedSinglePageAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSupported(this.client.getEndpoint(), clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, searchServiceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), null, null)); + } + + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSupportedAsync(String resourceGroupName, String searchServiceName, + UUID clientRequestId) { + return new PagedFlux<>( + () -> listSupportedSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId)); + } + + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSupportedAsync(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return new PagedFlux<>( + () -> listSupportedSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId)); + } + + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSupportedAsync(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + return new PagedFlux<>( + () -> listSupportedSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId, context)); + } + + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSupported(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return new PagedIterable<>(listSupportedAsync(resourceGroupName, searchServiceName, clientRequestId)); + } + + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSupported(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + return new PagedIterable<>(listSupportedAsync(resourceGroupName, searchServiceName, clientRequestId, context)); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..a27d23f6784b7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.search.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.search.models.PrivateLinkResource; +import com.azure.resourcemanager.search.models.PrivateLinkResources; +import java.util.UUID; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listSupported(String resourceGroupName, String searchServiceName) { + PagedIterable inner + = this.serviceClient().listSupported(resourceGroupName, searchServiceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listSupported(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + PagedIterable inner + = this.serviceClient().listSupported(resourceGroupName, searchServiceName, clientRequestId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeyImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeyImpl.java new file mode 100644 index 0000000000000..62ab2b4f493ff --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeyImpl.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.resourcemanager.search.fluent.models.QueryKeyInner; +import com.azure.resourcemanager.search.models.QueryKey; + +public final class QueryKeyImpl implements QueryKey { + private QueryKeyInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + QueryKeyImpl(QueryKeyInner innerObject, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String key() { + return this.innerModel().key(); + } + + public QueryKeyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysClientImpl.java new file mode 100644 index 0000000000000..7813961348872 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysClientImpl.java @@ -0,0 +1,660 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.search.fluent.QueryKeysClient; +import com.azure.resourcemanager.search.fluent.models.QueryKeyInner; +import com.azure.resourcemanager.search.models.ListQueryKeysResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in QueryKeysClient. + */ +public final class QueryKeysClientImpl implements QueryKeysClient { + /** + * The proxy service used to perform REST calls. + */ + private final QueryKeysService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of QueryKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueryKeysClientImpl(SearchManagementClientImpl client) { + this.service + = RestProxy.create(QueryKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientQueryKeys to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface QueryKeysService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, @PathParam("name") String name, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySearchService(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}") + @ExpectedResponses({ 200, 204, 404 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, @PathParam("key") String key, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySearchServiceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Generates a new query key for the specified search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs + * collection of an index along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String searchServiceName, + String name, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), resourceGroupName, searchServiceName, + name, clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Generates a new query key for the specified search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs + * collection of an index along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String searchServiceName, + String name, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), resourceGroupName, searchServiceName, name, clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + } + + /** + * Generates a new query key for the specified search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs + * collection of an index on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String searchServiceName, String name) { + final UUID clientRequestId = null; + return createWithResponseAsync(resourceGroupName, searchServiceName, name, clientRequestId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Generates a new query key for the specified search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs + * collection of an index along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, String searchServiceName, String name, + UUID clientRequestId, Context context) { + return createWithResponseAsync(resourceGroupName, searchServiceName, name, clientRequestId, context).block(); + } + + /** + * Generates a new query key for the specified search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs + * collection of an index. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryKeyInner create(String resourceGroupName, String searchServiceName, String name) { + final UUID clientRequestId = null; + return createWithResponse(resourceGroupName, searchServiceName, name, clientRequestId, Context.NONE).getValue(); + } + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySearchServiceSinglePageAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySearchService(this.client.getEndpoint(), resourceGroupName, searchServiceName, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySearchServiceSinglePageAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySearchService(this.client.getEndpoint(), resourceGroupName, searchServiceName, clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySearchServiceAsync(String resourceGroupName, String searchServiceName, + UUID clientRequestId) { + return new PagedFlux<>( + () -> listBySearchServiceSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId), + nextLink -> listBySearchServiceNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySearchServiceAsync(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return new PagedFlux<>( + () -> listBySearchServiceSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId), + nextLink -> listBySearchServiceNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySearchServiceAsync(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + return new PagedFlux<>( + () -> listBySearchServiceSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId, context), + nextLink -> listBySearchServiceNextSinglePageAsync(nextLink, clientRequestId, context)); + } + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySearchService(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return new PagedIterable<>(listBySearchServiceAsync(resourceGroupName, searchServiceName, clientRequestId)); + } + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySearchService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + return new PagedIterable<>( + listBySearchServiceAsync(resourceGroupName, searchServiceName, clientRequestId, context)); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating + * a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String searchServiceName, String key, + UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (key == null) { + return Mono.error(new IllegalArgumentException("Parameter key is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, searchServiceName, key, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating + * a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String searchServiceName, String key, + UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (key == null) { + return Mono.error(new IllegalArgumentException("Parameter key is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), resourceGroupName, searchServiceName, key, clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating + * a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String searchServiceName, String key) { + final UUID clientRequestId = null; + return deleteWithResponseAsync(resourceGroupName, searchServiceName, key, clientRequestId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating + * a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String searchServiceName, String key, + UUID clientRequestId, Context context) { + return deleteWithResponseAsync(resourceGroupName, searchServiceName, key, clientRequestId, context).block(); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating + * a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String searchServiceName, String key) { + final UUID clientRequestId = null; + deleteWithResponse(resourceGroupName, searchServiceName, key, clientRequestId, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySearchServiceNextSinglePageAsync(String nextLink, + UUID clientRequestId) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySearchServiceNext(nextLink, this.client.getEndpoint(), + clientRequestId, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySearchServiceNextSinglePageAsync(String nextLink, + UUID clientRequestId, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySearchServiceNext(nextLink, this.client.getEndpoint(), clientRequestId, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysImpl.java new file mode 100644 index 0000000000000..5ced3de766ecc --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysImpl.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.QueryKeysClient; +import com.azure.resourcemanager.search.fluent.models.QueryKeyInner; +import com.azure.resourcemanager.search.models.QueryKey; +import com.azure.resourcemanager.search.models.QueryKeys; +import java.util.UUID; + +public final class QueryKeysImpl implements QueryKeys { + private static final ClientLogger LOGGER = new ClientLogger(QueryKeysImpl.class); + + private final QueryKeysClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public QueryKeysImpl(QueryKeysClient innerClient, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response createWithResponse(String resourceGroupName, String searchServiceName, String name, + UUID clientRequestId, Context context) { + Response inner = this.serviceClient() + .createWithResponse(resourceGroupName, searchServiceName, name, clientRequestId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new QueryKeyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public QueryKey create(String resourceGroupName, String searchServiceName, String name) { + QueryKeyInner inner = this.serviceClient().create(resourceGroupName, searchServiceName, name); + if (inner != null) { + return new QueryKeyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listBySearchService(String resourceGroupName, String searchServiceName) { + PagedIterable inner + = this.serviceClient().listBySearchService(resourceGroupName, searchServiceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new QueryKeyImpl(inner1, this.manager())); + } + + public PagedIterable listBySearchService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + PagedIterable inner + = this.serviceClient().listBySearchService(resourceGroupName, searchServiceName, clientRequestId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new QueryKeyImpl(inner1, this.manager())); + } + + public Response deleteWithResponse(String resourceGroupName, String searchServiceName, String key, + UUID clientRequestId, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, searchServiceName, key, clientRequestId, context); + } + + public void delete(String resourceGroupName, String searchServiceName, String key) { + this.serviceClient().delete(resourceGroupName, searchServiceName, key); + } + + private QueryKeysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QuotaUsageResultImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QuotaUsageResultImpl.java new file mode 100644 index 0000000000000..de698fc1af29c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QuotaUsageResultImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner; +import com.azure.resourcemanager.search.models.QuotaUsageResult; +import com.azure.resourcemanager.search.models.QuotaUsageResultName; + +public final class QuotaUsageResultImpl implements QuotaUsageResult { + private QuotaUsageResultInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + QuotaUsageResultImpl(QuotaUsageResultInner innerObject, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public Integer currentValue() { + return this.innerModel().currentValue(); + } + + public Integer limit() { + return this.innerModel().limit(); + } + + public QuotaUsageResultName name() { + return this.innerModel().name(); + } + + public QuotaUsageResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ResourceManagerUtils.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..d7f3e40a894f3 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ResourceProvidersClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..810984322f68c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.search.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** + * The proxy service used to perform REST calls. + */ + private final ResourceProvidersService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(SearchManagementClientImpl client) { + this.service + = RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientResourceProviders to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface ResourceProvidersService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> usageBySubscriptionSku(@HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("skuName") String skuName, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the quota usage for a search sku in the given subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param skuName The unique SKU name that identifies a billable tier. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the quota usage for a search sku in the given subscription along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> usageBySubscriptionSkuWithResponseAsync(String location, + String skuName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (skuName == null) { + return Mono.error(new IllegalArgumentException("Parameter skuName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.usageBySubscriptionSku(this.client.getEndpoint(), clientRequestId, location, + this.client.getApiVersion(), this.client.getSubscriptionId(), skuName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the quota usage for a search sku in the given subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param skuName The unique SKU name that identifies a billable tier. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the quota usage for a search sku in the given subscription along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> usageBySubscriptionSkuWithResponseAsync(String location, + String skuName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (skuName == null) { + return Mono.error(new IllegalArgumentException("Parameter skuName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.usageBySubscriptionSku(this.client.getEndpoint(), clientRequestId, location, + this.client.getApiVersion(), this.client.getSubscriptionId(), skuName, accept, context); + } + + /** + * Gets the quota usage for a search sku in the given subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param skuName The unique SKU name that identifies a billable tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the quota usage for a search sku in the given subscription on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono usageBySubscriptionSkuAsync(String location, String skuName) { + final UUID clientRequestId = null; + return usageBySubscriptionSkuWithResponseAsync(location, skuName, clientRequestId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the quota usage for a search sku in the given subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param skuName The unique SKU name that identifies a billable tier. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the quota usage for a search sku in the given subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response usageBySubscriptionSkuWithResponse(String location, String skuName, + UUID clientRequestId, Context context) { + return usageBySubscriptionSkuWithResponseAsync(location, skuName, clientRequestId, context).block(); + } + + /** + * Gets the quota usage for a search sku in the given subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param skuName The unique SKU name that identifies a billable tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the quota usage for a search sku in the given subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QuotaUsageResultInner usageBySubscriptionSku(String location, String skuName) { + final UUID clientRequestId = null; + return usageBySubscriptionSkuWithResponse(location, skuName, clientRequestId, Context.NONE).getValue(); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ResourceProvidersImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..414b95ff1e549 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ResourceProvidersImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner; +import com.azure.resourcemanager.search.models.QuotaUsageResult; +import com.azure.resourcemanager.search.models.ResourceProviders; +import java.util.UUID; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response usageBySubscriptionSkuWithResponse(String location, String skuName, + UUID clientRequestId, Context context) { + Response inner + = this.serviceClient().usageBySubscriptionSkuWithResponse(location, skuName, clientRequestId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new QuotaUsageResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public QuotaUsageResult usageBySubscriptionSku(String location, String skuName) { + QuotaUsageResultInner inner = this.serviceClient().usageBySubscriptionSku(location, skuName); + if (inner != null) { + return new QuotaUsageResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientBuilder.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientBuilder.java new file mode 100644 index 0000000000000..32a76181b6ca7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientBuilder.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the SearchManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { SearchManagementClientImpl.class }) +public final class SearchManagementClientBuilder { + /* + * The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. + */ + private String subscriptionId; + + /** + * Sets The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource + * Manager API or the portal. + * + * @param subscriptionId the subscriptionId value. + * @return the SearchManagementClientBuilder. + */ + public SearchManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the SearchManagementClientBuilder. + */ + public SearchManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the SearchManagementClientBuilder. + */ + public SearchManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the SearchManagementClientBuilder. + */ + public SearchManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the SearchManagementClientBuilder. + */ + public SearchManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the SearchManagementClientBuilder. + */ + public SearchManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of SearchManagementClientImpl with the provided parameters. + * + * @return an instance of SearchManagementClientImpl. + */ + public SearchManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + SearchManagementClientImpl client = new SearchManagementClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientImpl.java new file mode 100644 index 0000000000000..9e3479bc655dd --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientImpl.java @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.search.fluent.AdminKeysClient; +import com.azure.resourcemanager.search.fluent.NetworkSecurityPerimeterConfigurationsClient; +import com.azure.resourcemanager.search.fluent.OperationsClient; +import com.azure.resourcemanager.search.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.search.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.search.fluent.QueryKeysClient; +import com.azure.resourcemanager.search.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.search.fluent.SearchManagementClient; +import com.azure.resourcemanager.search.fluent.ServicesClient; +import com.azure.resourcemanager.search.fluent.SharedPrivateLinkResourcesClient; +import com.azure.resourcemanager.search.fluent.UsagesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the SearchManagementClientImpl type. + */ +@ServiceClient(builder = SearchManagementClientBuilder.class) +public final class SearchManagementClientImpl implements SearchManagementClient { + /** + * The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource + * Manager API or the portal. + */ + private final String subscriptionId; + + /** + * Gets The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource + * Manager API or the portal. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The AdminKeysClient object to access its operations. + */ + private final AdminKeysClient adminKeys; + + /** + * Gets the AdminKeysClient object to access its operations. + * + * @return the AdminKeysClient object. + */ + public AdminKeysClient getAdminKeys() { + return this.adminKeys; + } + + /** + * The QueryKeysClient object to access its operations. + */ + private final QueryKeysClient queryKeys; + + /** + * Gets the QueryKeysClient object to access its operations. + * + * @return the QueryKeysClient object. + */ + public QueryKeysClient getQueryKeys() { + return this.queryKeys; + } + + /** + * The ServicesClient object to access its operations. + */ + private final ServicesClient services; + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + public ServicesClient getServices() { + return this.services; + } + + /** + * The PrivateLinkResourcesClient object to access its operations. + */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** + * The PrivateEndpointConnectionsClient object to access its operations. + */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * The SharedPrivateLinkResourcesClient object to access its operations. + */ + private final SharedPrivateLinkResourcesClient sharedPrivateLinkResources; + + /** + * Gets the SharedPrivateLinkResourcesClient object to access its operations. + * + * @return the SharedPrivateLinkResourcesClient object. + */ + public SharedPrivateLinkResourcesClient getSharedPrivateLinkResources() { + return this.sharedPrivateLinkResources; + } + + /** + * The UsagesClient object to access its operations. + */ + private final UsagesClient usages; + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + public UsagesClient getUsages() { + return this.usages; + } + + /** + * The ResourceProvidersClient object to access its operations. + */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** + * The NetworkSecurityPerimeterConfigurationsClient object to access its operations. + */ + private final NetworkSecurityPerimeterConfigurationsClient networkSecurityPerimeterConfigurations; + + /** + * Gets the NetworkSecurityPerimeterConfigurationsClient object to access its operations. + * + * @return the NetworkSecurityPerimeterConfigurationsClient object. + */ + public NetworkSecurityPerimeterConfigurationsClient getNetworkSecurityPerimeterConfigurations() { + return this.networkSecurityPerimeterConfigurations; + } + + /** + * Initializes an instance of SearchManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The unique identifier for a Microsoft Azure subscription. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param endpoint server parameter. + */ + SearchManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2024-06-01-preview"; + this.operations = new OperationsClientImpl(this); + this.adminKeys = new AdminKeysClientImpl(this); + this.queryKeys = new QueryKeysClientImpl(this); + this.services = new ServicesClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.sharedPrivateLinkResources = new SharedPrivateLinkResourcesClientImpl(this); + this.usages = new UsagesClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.networkSecurityPerimeterConfigurations = new NetworkSecurityPerimeterConfigurationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SearchManagementClientImpl.class); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchServiceImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchServiceImpl.java new file mode 100644 index 0000000000000..1ff30a66c1fa1 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchServiceImpl.java @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.search.fluent.models.SearchServiceInner; +import com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner; +import com.azure.resourcemanager.search.models.DataPlaneAuthOptions; +import com.azure.resourcemanager.search.models.EncryptionWithCmk; +import com.azure.resourcemanager.search.models.HostingMode; +import com.azure.resourcemanager.search.models.Identity; +import com.azure.resourcemanager.search.models.NetworkRuleSet; +import com.azure.resourcemanager.search.models.PrivateEndpointConnection; +import com.azure.resourcemanager.search.models.ProvisioningState; +import com.azure.resourcemanager.search.models.PublicNetworkAccess; +import com.azure.resourcemanager.search.models.SearchDisabledDataExfiltrationOption; +import com.azure.resourcemanager.search.models.SearchSemanticSearch; +import com.azure.resourcemanager.search.models.SearchService; +import com.azure.resourcemanager.search.models.SearchServiceStatus; +import com.azure.resourcemanager.search.models.SearchServiceUpdate; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResource; +import com.azure.resourcemanager.search.models.Sku; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +public final class SearchServiceImpl implements SearchService, SearchService.Definition, SearchService.Update { + private SearchServiceInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public Integer replicaCount() { + return this.innerModel().replicaCount(); + } + + public Integer partitionCount() { + return this.innerModel().partitionCount(); + } + + public HostingMode hostingMode() { + return this.innerModel().hostingMode(); + } + + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public SearchServiceStatus status() { + return this.innerModel().status(); + } + + public String statusDetails() { + return this.innerModel().statusDetails(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public NetworkRuleSet networkRuleSet() { + return this.innerModel().networkRuleSet(); + } + + public List disabledDataExfiltrationOptions() { + List inner = this.innerModel().disabledDataExfiltrationOptions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EncryptionWithCmk encryptionWithCmk() { + return this.innerModel().encryptionWithCmk(); + } + + public Boolean disableLocalAuth() { + return this.innerModel().disableLocalAuth(); + } + + public DataPlaneAuthOptions authOptions() { + return this.innerModel().authOptions(); + } + + public SearchSemanticSearch semanticSearch() { + return this.innerModel().semanticSearch(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner.stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public List sharedPrivateLinkResources() { + List inner = this.innerModel().sharedPrivateLinkResources(); + if (inner != null) { + return Collections.unmodifiableList(inner.stream() + .map(inner1 -> new SharedPrivateLinkResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SearchServiceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String searchServiceName; + + private UUID createClientRequestId; + + private UUID updateClientRequestId; + + private SearchServiceUpdate updateServiceParam; + + public SearchServiceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SearchService create() { + this.innerObject = serviceManager.serviceClient() + .getServices() + .createOrUpdate(resourceGroupName, searchServiceName, this.innerModel(), createClientRequestId, + Context.NONE); + return this; + } + + public SearchService create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getServices() + .createOrUpdate(resourceGroupName, searchServiceName, this.innerModel(), createClientRequestId, context); + return this; + } + + SearchServiceImpl(String name, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = new SearchServiceInner(); + this.serviceManager = serviceManager; + this.searchServiceName = name; + this.createClientRequestId = null; + } + + public SearchServiceImpl update() { + this.updateClientRequestId = null; + this.updateServiceParam = new SearchServiceUpdate(); + return this; + } + + public SearchService apply() { + this.innerObject = serviceManager.serviceClient() + .getServices() + .updateWithResponse(resourceGroupName, searchServiceName, updateServiceParam, updateClientRequestId, + Context.NONE) + .getValue(); + return this; + } + + public SearchService apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getServices() + .updateWithResponse(resourceGroupName, searchServiceName, updateServiceParam, updateClientRequestId, + context) + .getValue(); + return this; + } + + SearchServiceImpl(SearchServiceInner innerObject, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.searchServiceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "searchServices"); + } + + public SearchService refresh() { + UUID localClientRequestId = null; + this.innerObject = serviceManager.serviceClient() + .getServices() + .getByResourceGroupWithResponse(resourceGroupName, searchServiceName, localClientRequestId, Context.NONE) + .getValue(); + return this; + } + + public SearchService refresh(Context context) { + UUID localClientRequestId = null; + this.innerObject = serviceManager.serviceClient() + .getServices() + .getByResourceGroupWithResponse(resourceGroupName, searchServiceName, localClientRequestId, context) + .getValue(); + return this; + } + + public SearchServiceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SearchServiceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SearchServiceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateServiceParam.withTags(tags); + return this; + } + } + + public SearchServiceImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateServiceParam.withSku(sku); + return this; + } + } + + public SearchServiceImpl withIdentity(Identity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateServiceParam.withIdentity(identity); + return this; + } + } + + public SearchServiceImpl withReplicaCount(Integer replicaCount) { + if (isInCreateMode()) { + this.innerModel().withReplicaCount(replicaCount); + return this; + } else { + this.updateServiceParam.withReplicaCount(replicaCount); + return this; + } + } + + public SearchServiceImpl withPartitionCount(Integer partitionCount) { + if (isInCreateMode()) { + this.innerModel().withPartitionCount(partitionCount); + return this; + } else { + this.updateServiceParam.withPartitionCount(partitionCount); + return this; + } + } + + public SearchServiceImpl withHostingMode(HostingMode hostingMode) { + if (isInCreateMode()) { + this.innerModel().withHostingMode(hostingMode); + return this; + } else { + this.updateServiceParam.withHostingMode(hostingMode); + return this; + } + } + + public SearchServiceImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } else { + this.updateServiceParam.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + } + + public SearchServiceImpl withNetworkRuleSet(NetworkRuleSet networkRuleSet) { + if (isInCreateMode()) { + this.innerModel().withNetworkRuleSet(networkRuleSet); + return this; + } else { + this.updateServiceParam.withNetworkRuleSet(networkRuleSet); + return this; + } + } + + public SearchServiceImpl withDisabledDataExfiltrationOptions( + List disabledDataExfiltrationOptions) { + if (isInCreateMode()) { + this.innerModel().withDisabledDataExfiltrationOptions(disabledDataExfiltrationOptions); + return this; + } else { + this.updateServiceParam.withDisabledDataExfiltrationOptions(disabledDataExfiltrationOptions); + return this; + } + } + + public SearchServiceImpl withEncryptionWithCmk(EncryptionWithCmk encryptionWithCmk) { + if (isInCreateMode()) { + this.innerModel().withEncryptionWithCmk(encryptionWithCmk); + return this; + } else { + this.updateServiceParam.withEncryptionWithCmk(encryptionWithCmk); + return this; + } + } + + public SearchServiceImpl withDisableLocalAuth(Boolean disableLocalAuth) { + if (isInCreateMode()) { + this.innerModel().withDisableLocalAuth(disableLocalAuth); + return this; + } else { + this.updateServiceParam.withDisableLocalAuth(disableLocalAuth); + return this; + } + } + + public SearchServiceImpl withAuthOptions(DataPlaneAuthOptions authOptions) { + if (isInCreateMode()) { + this.innerModel().withAuthOptions(authOptions); + return this; + } else { + this.updateServiceParam.withAuthOptions(authOptions); + return this; + } + } + + public SearchServiceImpl withSemanticSearch(SearchSemanticSearch semanticSearch) { + if (isInCreateMode()) { + this.innerModel().withSemanticSearch(semanticSearch); + return this; + } else { + this.updateServiceParam.withSemanticSearch(semanticSearch); + return this; + } + } + + public SearchServiceImpl withClientRequestId(UUID clientRequestId) { + if (isInCreateMode()) { + this.createClientRequestId = clientRequestId; + return this; + } else { + this.updateClientRequestId = clientRequestId; + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesClientImpl.java new file mode 100644 index 0000000000000..15848087f7768 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesClientImpl.java @@ -0,0 +1,1526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.search.fluent.ServicesClient; +import com.azure.resourcemanager.search.fluent.models.CheckNameAvailabilityOutputInner; +import com.azure.resourcemanager.search.fluent.models.SearchServiceInner; +import com.azure.resourcemanager.search.models.CheckNameAvailabilityInput; +import com.azure.resourcemanager.search.models.SearchServiceListResult; +import com.azure.resourcemanager.search.models.SearchServiceUpdate; +import java.nio.ByteBuffer; +import java.util.UUID; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ServicesClient. + */ +public final class ServicesClientImpl implements ServicesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ServicesService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of ServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServicesClientImpl(SearchManagementClientImpl client) { + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientServices to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface ServicesService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") SearchServiceInner service, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") SearchServiceUpdate service, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}") + @ExpectedResponses({ 200, 204, 404 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability(@HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CheckNameAvailabilityInput checkNameAvailabilityInput, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (serviceParam == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceParam is required and cannot be null.")); + } else { + serviceParam.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, + searchServiceName, clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), + serviceParam, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (serviceParam == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceParam is required and cannot be null.")); + } else { + serviceParam.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, searchServiceName, clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), serviceParam, accept, context); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SearchServiceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SearchServiceInner.class, SearchServiceInner.class, this.client.getContext()); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SearchServiceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String searchServiceName, SearchServiceInner serviceParam) { + final UUID clientRequestId = null; + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SearchServiceInner.class, SearchServiceInner.class, this.client.getContext()); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SearchServiceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, searchServiceName, + serviceParam, clientRequestId, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SearchServiceInner.class, SearchServiceInner.class, context); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SearchServiceInner> beginCreateOrUpdate(String resourceGroupName, + String searchServiceName, SearchServiceInner serviceParam) { + final UUID clientRequestId = null; + return this.beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId) + .getSyncPoller(); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SearchServiceInner> beginCreateOrUpdate(String resourceGroupName, + String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId, context) + .getSyncPoller(); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String searchServiceName, + SearchServiceInner serviceParam, UUID clientRequestId) { + return beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String searchServiceName, + SearchServiceInner serviceParam) { + final UUID clientRequestId = null; + return beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String searchServiceName, + SearchServiceInner serviceParam, UUID clientRequestId, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchServiceInner createOrUpdate(String resourceGroupName, String searchServiceName, + SearchServiceInner serviceParam) { + final UUID clientRequestId = null; + return createOrUpdateAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId).block(); + } + + /** + * Creates or updates a search service in the given resource group. If the search service already exists, all + * properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to create or update. Search service names must + * only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot + * contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be + * globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot + * change the service name after the service is created. + * @param serviceParam The definition of the search service to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchServiceInner createOrUpdate(String resourceGroupName, String searchServiceName, + SearchServiceInner serviceParam, UUID clientRequestId, Context context) { + return createOrUpdateAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId, context) + .block(); + } + + /** + * Updates an existing search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to update. + * @param serviceParam The definition of the search service to update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String searchServiceName, SearchServiceUpdate serviceParam, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (serviceParam == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceParam is required and cannot be null.")); + } else { + serviceParam.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), resourceGroupName, searchServiceName, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), serviceParam, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to update. + * @param serviceParam The definition of the search service to update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String searchServiceName, SearchServiceUpdate serviceParam, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (serviceParam == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceParam is required and cannot be null.")); + } else { + serviceParam.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), resourceGroupName, searchServiceName, clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), serviceParam, accept, context); + } + + /** + * Updates an existing search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to update. + * @param serviceParam The definition of the search service to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String searchServiceName, + SearchServiceUpdate serviceParam) { + final UUID clientRequestId = null; + return updateWithResponseAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to update. + * @param serviceParam The definition of the search service to update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String searchServiceName, + SearchServiceUpdate serviceParam, UUID clientRequestId, Context context) { + return updateWithResponseAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId, context) + .block(); + } + + /** + * Updates an existing search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service to update. + * @param serviceParam The definition of the search service to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an Azure AI Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchServiceInner update(String resourceGroupName, String searchServiceName, + SearchServiceUpdate serviceParam) { + final UUID clientRequestId = null; + return updateWithResponse(resourceGroupName, searchServiceName, serviceParam, clientRequestId, Context.NONE) + .getValue(); + } + + /** + * Gets the search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, searchServiceName, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, searchServiceName, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + } + + /** + * Gets the search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, searchServiceName, clientRequestId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, searchServiceName, clientRequestId, context) + .block(); + } + + /** + * Gets the search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchServiceInner getByResourceGroup(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return getByResourceGroupWithResponse(resourceGroupName, searchServiceName, clientRequestId, Context.NONE) + .getValue(); + } + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String searchServiceName, + UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, searchServiceName, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), resourceGroupName, searchServiceName, clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + } + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return deleteWithResponseAsync(resourceGroupName, searchServiceName, clientRequestId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String searchServiceName, UUID clientRequestId, + Context context) { + return deleteWithResponseAsync(resourceGroupName, searchServiceName, clientRequestId, context).block(); + } + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + deleteWithResponse(resourceGroupName, searchServiceName, clientRequestId, Context.NONE); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), resourceGroupName, + clientRequestId, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), resourceGroupName, clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, UUID clientRequestId) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, clientRequestId), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final UUID clientRequestId = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, clientRequestId), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, UUID clientRequestId, + Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, clientRequestId, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, clientRequestId, context)); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final UUID clientRequestId = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, clientRequestId)); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, UUID clientRequestId, + Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, clientRequestId, context)); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(UUID clientRequestId) { + return new PagedFlux<>(() -> listSinglePageAsync(clientRequestId), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final UUID clientRequestId = null; + return new PagedFlux<>(() -> listSinglePageAsync(clientRequestId), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(UUID clientRequestId, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(clientRequestId, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, clientRequestId, context)); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final UUID clientRequestId = null; + return new PagedIterable<>(listAsync(clientRequestId)); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(UUID clientRequestId, Context context) { + return new PagedIterable<>(listAsync(clientRequestId, context)); + } + + /** + * Checks whether or not the given search service name is available for use. Search service names must be globally + * unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param checkNameAvailabilityInput The resource name and type to check. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of check name availability API along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityInput checkNameAvailabilityInput, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (checkNameAvailabilityInput == null) { + return Mono.error( + new IllegalArgumentException("Parameter checkNameAvailabilityInput is required and cannot be null.")); + } else { + checkNameAvailabilityInput.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.checkNameAvailability(this.client.getEndpoint(), clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), checkNameAvailabilityInput, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks whether or not the given search service name is available for use. Search service names must be globally + * unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param checkNameAvailabilityInput The resource name and type to check. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of check name availability API along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityInput checkNameAvailabilityInput, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (checkNameAvailabilityInput == null) { + return Mono.error( + new IllegalArgumentException("Parameter checkNameAvailabilityInput is required and cannot be null.")); + } else { + checkNameAvailabilityInput.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.checkNameAvailability(this.client.getEndpoint(), clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), checkNameAvailabilityInput, accept, context); + } + + /** + * Checks whether or not the given search service name is available for use. Search service names must be globally + * unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param checkNameAvailabilityInput The resource name and type to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of check name availability API on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + checkNameAvailabilityAsync(CheckNameAvailabilityInput checkNameAvailabilityInput) { + final UUID clientRequestId = null; + return checkNameAvailabilityWithResponseAsync(checkNameAvailabilityInput, clientRequestId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Checks whether or not the given search service name is available for use. Search service names must be globally + * unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param checkNameAvailabilityInput The resource name and type to check. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of check name availability API along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityInput checkNameAvailabilityInput, UUID clientRequestId, Context context) { + return checkNameAvailabilityWithResponseAsync(checkNameAvailabilityInput, clientRequestId, context).block(); + } + + /** + * Checks whether or not the given search service name is available for use. Search service names must be globally + * unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param checkNameAvailabilityInput The resource name and type to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of check name availability API. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityOutputInner + checkNameAvailability(CheckNameAvailabilityInput checkNameAvailabilityInput) { + final UUID clientRequestId = null; + return checkNameAvailabilityWithResponse(checkNameAvailabilityInput, clientRequestId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing a list of Azure AI Search services along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + UUID clientRequestId) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), + clientRequestId, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing a list of Azure AI Search services along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + UUID clientRequestId, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), clientRequestId, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing a list of Azure AI Search services along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + UUID clientRequestId) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), clientRequestId, + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing a list of Azure AI Search services along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + UUID clientRequestId, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), clientRequestId, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesImpl.java new file mode 100644 index 0000000000000..a2168a492ff62 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.ServicesClient; +import com.azure.resourcemanager.search.fluent.models.CheckNameAvailabilityOutputInner; +import com.azure.resourcemanager.search.fluent.models.SearchServiceInner; +import com.azure.resourcemanager.search.models.CheckNameAvailabilityInput; +import com.azure.resourcemanager.search.models.CheckNameAvailabilityOutput; +import com.azure.resourcemanager.search.models.SearchService; +import com.azure.resourcemanager.search.models.Services; +import java.util.UUID; + +public final class ServicesImpl implements Services { + private static final ClientLogger LOGGER = new ClientLogger(ServicesImpl.class); + + private final ServicesClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public ServicesImpl(ServicesClient innerClient, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, searchServiceName, clientRequestId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SearchServiceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SearchService getByResourceGroup(String resourceGroupName, String searchServiceName) { + SearchServiceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, searchServiceName); + if (inner != null) { + return new SearchServiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String searchServiceName, UUID clientRequestId, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, searchServiceName, clientRequestId, context); + } + + public void delete(String resourceGroupName, String searchServiceName) { + this.serviceClient().delete(resourceGroupName, searchServiceName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SearchServiceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, UUID clientRequestId, + Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, clientRequestId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SearchServiceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SearchServiceImpl(inner1, this.manager())); + } + + public PagedIterable list(UUID clientRequestId, Context context) { + PagedIterable inner = this.serviceClient().list(clientRequestId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SearchServiceImpl(inner1, this.manager())); + } + + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityInput checkNameAvailabilityInput, UUID clientRequestId, Context context) { + Response inner = this.serviceClient() + .checkNameAvailabilityWithResponse(checkNameAvailabilityInput, clientRequestId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckNameAvailabilityOutputImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityOutput checkNameAvailability(CheckNameAvailabilityInput checkNameAvailabilityInput) { + CheckNameAvailabilityOutputInner inner = this.serviceClient().checkNameAvailability(checkNameAvailabilityInput); + if (inner != null) { + return new CheckNameAvailabilityOutputImpl(inner, this.manager()); + } else { + return null; + } + } + + public SearchService getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String searchServiceName = ResourceManagerUtils.getValueFromIdByName(id, "searchServices"); + if (searchServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'searchServices'.", id))); + } + UUID localClientRequestId = null; + return this + .getByResourceGroupWithResponse(resourceGroupName, searchServiceName, localClientRequestId, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, UUID clientRequestId, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String searchServiceName = ResourceManagerUtils.getValueFromIdByName(id, "searchServices"); + if (searchServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'searchServices'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, searchServiceName, clientRequestId, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String searchServiceName = ResourceManagerUtils.getValueFromIdByName(id, "searchServices"); + if (searchServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'searchServices'.", id))); + } + UUID localClientRequestId = null; + this.deleteWithResponse(resourceGroupName, searchServiceName, localClientRequestId, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, UUID clientRequestId, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String searchServiceName = ResourceManagerUtils.getValueFromIdByName(id, "searchServices"); + if (searchServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'searchServices'.", id))); + } + return this.deleteWithResponse(resourceGroupName, searchServiceName, clientRequestId, context); + } + + private ServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } + + public SearchServiceImpl define(String name) { + return new SearchServiceImpl(name, this.manager()); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourceImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..8674829380ca6 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourceImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResource; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResourceProperties; +import java.util.UUID; + +public final class SharedPrivateLinkResourceImpl + implements SharedPrivateLinkResource, SharedPrivateLinkResource.Definition, SharedPrivateLinkResource.Update { + private SharedPrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SharedPrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SharedPrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String searchServiceName; + + private String sharedPrivateLinkResourceName; + + private UUID createClientRequestId; + + private UUID updateClientRequestId; + + public SharedPrivateLinkResourceImpl withExistingSearchService(String resourceGroupName, String searchServiceName) { + this.resourceGroupName = resourceGroupName; + this.searchServiceName = searchServiceName; + return this; + } + + public SharedPrivateLinkResource create() { + this.innerObject = serviceManager.serviceClient() + .getSharedPrivateLinkResources() + .createOrUpdate(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, this.innerModel(), + createClientRequestId, Context.NONE); + return this; + } + + public SharedPrivateLinkResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSharedPrivateLinkResources() + .createOrUpdate(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, this.innerModel(), + createClientRequestId, context); + return this; + } + + SharedPrivateLinkResourceImpl(String name, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = new SharedPrivateLinkResourceInner(); + this.serviceManager = serviceManager; + this.sharedPrivateLinkResourceName = name; + this.createClientRequestId = null; + } + + public SharedPrivateLinkResourceImpl update() { + this.updateClientRequestId = null; + return this; + } + + public SharedPrivateLinkResource apply() { + this.innerObject = serviceManager.serviceClient() + .getSharedPrivateLinkResources() + .createOrUpdate(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, this.innerModel(), + updateClientRequestId, Context.NONE); + return this; + } + + public SharedPrivateLinkResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSharedPrivateLinkResources() + .createOrUpdate(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, this.innerModel(), + updateClientRequestId, context); + return this; + } + + SharedPrivateLinkResourceImpl(SharedPrivateLinkResourceInner innerObject, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.searchServiceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "searchServices"); + this.sharedPrivateLinkResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sharedPrivateLinkResources"); + } + + public SharedPrivateLinkResource refresh() { + UUID localClientRequestId = null; + this.innerObject = serviceManager.serviceClient() + .getSharedPrivateLinkResources() + .getWithResponse(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, localClientRequestId, + Context.NONE) + .getValue(); + return this; + } + + public SharedPrivateLinkResource refresh(Context context) { + UUID localClientRequestId = null; + this.innerObject = serviceManager.serviceClient() + .getSharedPrivateLinkResources() + .getWithResponse(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, localClientRequestId, + context) + .getValue(); + return this; + } + + public SharedPrivateLinkResourceImpl withProperties(SharedPrivateLinkResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public SharedPrivateLinkResourceImpl withClientRequestId(UUID clientRequestId) { + if (isInCreateMode()) { + this.createClientRequestId = clientRequestId; + return this; + } else { + this.updateClientRequestId = clientRequestId; + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..e93b4c616d0e0 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesClientImpl.java @@ -0,0 +1,1251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.search.fluent.SharedPrivateLinkResourcesClient; +import com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResourceListResult; +import java.nio.ByteBuffer; +import java.util.UUID; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SharedPrivateLinkResourcesClient. + */ +public final class SharedPrivateLinkResourcesClientImpl implements SharedPrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SharedPrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of SharedPrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SharedPrivateLinkResourcesClientImpl(SearchManagementClientImpl client) { + this.service = RestProxy.create(SharedPrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientSharedPrivateLinkResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface SharedPrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @PathParam("sharedPrivateLinkResourceName") String sharedPrivateLinkResourceName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") SharedPrivateLinkResourceInner sharedPrivateLinkResource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @PathParam("sharedPrivateLinkResourceName") String sharedPrivateLinkResourceName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}") + @ExpectedResponses({ 202, 204, 404 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, + @PathParam("sharedPrivateLinkResourceName") String sharedPrivateLinkResourceName, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByService(@HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("searchServiceName") String searchServiceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServiceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a shared private link resource managed by the Azure AI Search service along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String searchServiceName, String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (sharedPrivateLinkResourceName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sharedPrivateLinkResourceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (sharedPrivateLinkResource == null) { + return Mono.error( + new IllegalArgumentException("Parameter sharedPrivateLinkResource is required and cannot be null.")); + } else { + sharedPrivateLinkResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, + searchServiceName, sharedPrivateLinkResourceName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), sharedPrivateLinkResource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a shared private link resource managed by the Azure AI Search service along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String searchServiceName, String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (sharedPrivateLinkResourceName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sharedPrivateLinkResourceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (sharedPrivateLinkResource == null) { + return Mono.error( + new IllegalArgumentException("Parameter sharedPrivateLinkResource is required and cannot be null.")); + } else { + sharedPrivateLinkResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), sharedPrivateLinkResource, accept, context); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of describes a shared private link resource managed by the Azure AI + * Search service. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SharedPrivateLinkResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, sharedPrivateLinkResource, clientRequestId); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SharedPrivateLinkResourceInner.class, SharedPrivateLinkResourceInner.class, + this.client.getContext()); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of describes a shared private link resource managed by the Azure AI + * Search service. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SharedPrivateLinkResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource) { + final UUID clientRequestId = null; + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, sharedPrivateLinkResource, clientRequestId); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SharedPrivateLinkResourceInner.class, SharedPrivateLinkResourceInner.class, + this.client.getContext()); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of describes a shared private link resource managed by the Azure AI + * Search service. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SharedPrivateLinkResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, sharedPrivateLinkResource, clientRequestId, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SharedPrivateLinkResourceInner.class, SharedPrivateLinkResourceInner.class, + context); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a shared private link resource managed by the Azure AI + * Search service. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SharedPrivateLinkResourceInner> beginCreateOrUpdate( + String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource) { + final UUID clientRequestId = null; + return this + .beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + sharedPrivateLinkResource, clientRequestId) + .getSyncPoller(); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a shared private link resource managed by the Azure AI + * Search service. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SharedPrivateLinkResourceInner> beginCreateOrUpdate( + String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource, UUID clientRequestId, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + sharedPrivateLinkResource, clientRequestId, context) + .getSyncPoller(); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a shared private link resource managed by the Azure AI Search service on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId) { + return beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + sharedPrivateLinkResource, clientRequestId).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a shared private link resource managed by the Azure AI Search service on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource) { + final UUID clientRequestId = null; + return beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + sharedPrivateLinkResource, clientRequestId).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a shared private link resource managed by the Azure AI Search service on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + sharedPrivateLinkResource, clientRequestId, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a shared private link resource managed by the Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedPrivateLinkResourceInner createOrUpdate(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource) { + final UUID clientRequestId = null; + return createOrUpdateAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + sharedPrivateLinkResource, clientRequestId).block(); + } + + /** + * Initiates the creation or update of a shared private link resource managed by the search service in the given + * resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param sharedPrivateLinkResource The definition of the shared private link resource to create or update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a shared private link resource managed by the Azure AI Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedPrivateLinkResourceInner createOrUpdate(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId, Context context) { + return createOrUpdateAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + sharedPrivateLinkResource, clientRequestId, context).block(); + } + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource group + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String searchServiceName, String sharedPrivateLinkResourceName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (sharedPrivateLinkResourceName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sharedPrivateLinkResourceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource group + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String searchServiceName, String sharedPrivateLinkResourceName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (sharedPrivateLinkResourceName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sharedPrivateLinkResourceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + } + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource group + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName) { + final UUID clientRequestId = null; + return getWithResponseAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + clientRequestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource group + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId, Context context) { + return getWithResponseAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + clientRequestId, context).block(); + } + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource + * group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedPrivateLinkResourceInner get(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName) { + final UUID clientRequestId = null; + return getWithResponse(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId, + Context.NONE).getValue(); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (sharedPrivateLinkResourceName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sharedPrivateLinkResourceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + if (sharedPrivateLinkResourceName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter sharedPrivateLinkResourceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, clientRequestId); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName) { + final UUID clientRequestId = null; + Mono>> mono = deleteWithResponseAsync(resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, clientRequestId); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, searchServiceName, + sharedPrivateLinkResourceName, clientRequestId, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName) { + final UUID clientRequestId = null; + return this + .beginDeleteAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId) + .getSyncPoller(); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId, Context context) { + return this + .beginDeleteAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId, + context) + .getSyncPoller(); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId) { + return beginDeleteAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName) { + final UUID clientRequestId = null; + return beginDeleteAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId, Context context) { + return beginDeleteAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName) { + final UUID clientRequestId = null; + deleteAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId).block(); + } + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName, + UUID clientRequestId, Context context) { + deleteAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId, context) + .block(); + } + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServiceSinglePageAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByService(this.client.getEndpoint(), clientRequestId, + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, searchServiceName, + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServiceSinglePageAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (searchServiceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByService(this.client.getEndpoint(), clientRequestId, this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, searchServiceName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId) { + return new PagedFlux<>( + () -> listByServiceSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId), + nextLink -> listByServiceNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceAsync(String resourceGroupName, + String searchServiceName) { + final UUID clientRequestId = null; + return new PagedFlux<>( + () -> listByServiceSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId), + nextLink -> listByServiceNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceAsync(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + return new PagedFlux<>( + () -> listByServiceSinglePageAsync(resourceGroupName, searchServiceName, clientRequestId, context), + nextLink -> listByServiceNextSinglePageAsync(nextLink, clientRequestId, context)); + } + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByService(String resourceGroupName, + String searchServiceName) { + final UUID clientRequestId = null; + return new PagedIterable<>(listByServiceAsync(resourceGroupName, searchServiceName, clientRequestId)); + } + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByService(String resourceGroupName, + String searchServiceName, UUID clientRequestId, Context context) { + return new PagedIterable<>(listByServiceAsync(resourceGroupName, searchServiceName, clientRequestId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing a list of shared private link resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServiceNextSinglePageAsync(String nextLink, + UUID clientRequestId) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listByServiceNext(nextLink, this.client.getEndpoint(), clientRequestId, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing a list of shared private link resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServiceNextSinglePageAsync(String nextLink, + UUID clientRequestId, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByServiceNext(nextLink, this.client.getEndpoint(), clientRequestId, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..6bb9348df2b6d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.SharedPrivateLinkResourcesClient; +import com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResource; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResources; +import java.util.UUID; + +public final class SharedPrivateLinkResourcesImpl implements SharedPrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(SharedPrivateLinkResourcesImpl.class); + + private final SharedPrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public SharedPrivateLinkResourcesImpl(SharedPrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SharedPrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SharedPrivateLinkResource get(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName) { + SharedPrivateLinkResourceInner inner + = this.serviceClient().get(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName); + if (inner != null) { + return new SharedPrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName) { + this.serviceClient().delete(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName); + } + + public void delete(String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName, + UUID clientRequestId, Context context) { + this.serviceClient() + .delete(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId, context); + } + + public PagedIterable listByService(String resourceGroupName, String searchServiceName) { + PagedIterable inner + = this.serviceClient().listByService(resourceGroupName, searchServiceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SharedPrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context) { + PagedIterable inner + = this.serviceClient().listByService(resourceGroupName, searchServiceName, clientRequestId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SharedPrivateLinkResourceImpl(inner1, this.manager())); + } + + public SharedPrivateLinkResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String searchServiceName = ResourceManagerUtils.getValueFromIdByName(id, "searchServices"); + if (searchServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'searchServices'.", id))); + } + String sharedPrivateLinkResourceName + = ResourceManagerUtils.getValueFromIdByName(id, "sharedPrivateLinkResources"); + if (sharedPrivateLinkResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'sharedPrivateLinkResources'.", id))); + } + UUID localClientRequestId = null; + return this + .getWithResponse(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, localClientRequestId, + Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, UUID clientRequestId, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String searchServiceName = ResourceManagerUtils.getValueFromIdByName(id, "searchServices"); + if (searchServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'searchServices'.", id))); + } + String sharedPrivateLinkResourceName + = ResourceManagerUtils.getValueFromIdByName(id, "sharedPrivateLinkResources"); + if (sharedPrivateLinkResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'sharedPrivateLinkResources'.", id))); + } + return this.getWithResponse(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, + clientRequestId, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String searchServiceName = ResourceManagerUtils.getValueFromIdByName(id, "searchServices"); + if (searchServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'searchServices'.", id))); + } + String sharedPrivateLinkResourceName + = ResourceManagerUtils.getValueFromIdByName(id, "sharedPrivateLinkResources"); + if (sharedPrivateLinkResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'sharedPrivateLinkResources'.", id))); + } + UUID localClientRequestId = null; + this.delete(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, localClientRequestId, + Context.NONE); + } + + public void deleteByIdWithResponse(String id, UUID clientRequestId, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String searchServiceName = ResourceManagerUtils.getValueFromIdByName(id, "searchServices"); + if (searchServiceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'searchServices'.", id))); + } + String sharedPrivateLinkResourceName + = ResourceManagerUtils.getValueFromIdByName(id, "sharedPrivateLinkResources"); + if (sharedPrivateLinkResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'sharedPrivateLinkResources'.", id))); + } + this.delete(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId, context); + } + + private SharedPrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } + + public SharedPrivateLinkResourceImpl define(String name) { + return new SharedPrivateLinkResourceImpl(name, this.manager()); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/UsagesClientImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/UsagesClientImpl.java new file mode 100644 index 0000000000000..a0656d8ac6d9f --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/UsagesClientImpl.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.search.fluent.UsagesClient; +import com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner; +import com.azure.resourcemanager.search.models.QuotaUsagesListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UsagesClient. + */ +public final class UsagesClientImpl implements UsagesClient { + /** + * The proxy service used to perform REST calls. + */ + private final UsagesService service; + + /** + * The service client containing this operation class. + */ + private final SearchManagementClientImpl client; + + /** + * Initializes an instance of UsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UsagesClientImpl(SearchManagementClientImpl client) { + this.service = RestProxy.create(UsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SearchManagementClientUsages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SearchManagementClie") + public interface UsagesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("x-ms-client-request-id") UUID clientRequestId, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String location, + UUID clientRequestId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscription(this.client.getEndpoint(), clientRequestId, location, + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String location, + UUID clientRequestId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscription(this.client.getEndpoint(), clientRequestId, location, this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String location, UUID clientRequestId) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(location, clientRequestId), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String location) { + final UUID clientRequestId = null; + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(location, clientRequestId), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, clientRequestId)); + } + + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String location, UUID clientRequestId, + Context context) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(location, clientRequestId, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, clientRequestId, context)); + } + + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String location) { + final UUID clientRequestId = null; + return new PagedIterable<>(listBySubscriptionAsync(location, clientRequestId)); + } + + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String location, UUID clientRequestId, + Context context) { + return new PagedIterable<>(listBySubscriptionAsync(location, clientRequestId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the quota usage information for all the supported SKUs of Azure AI Search along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + UUID clientRequestId) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), clientRequestId, + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the quota usage information for all the supported SKUs of Azure AI Search along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + UUID clientRequestId, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), clientRequestId, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/UsagesImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/UsagesImpl.java new file mode 100644 index 0000000000000..ce8004de166ba --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/UsagesImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.UsagesClient; +import com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner; +import com.azure.resourcemanager.search.models.QuotaUsageResult; +import com.azure.resourcemanager.search.models.Usages; +import java.util.UUID; + +public final class UsagesImpl implements Usages { + private static final ClientLogger LOGGER = new ClientLogger(UsagesImpl.class); + + private final UsagesClient innerClient; + + private final com.azure.resourcemanager.search.SearchManager serviceManager; + + public UsagesImpl(UsagesClient innerClient, com.azure.resourcemanager.search.SearchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySubscription(String location) { + PagedIterable inner = this.serviceClient().listBySubscription(location); + return ResourceManagerUtils.mapPage(inner, inner1 -> new QuotaUsageResultImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String location, UUID clientRequestId, Context context) { + PagedIterable inner + = this.serviceClient().listBySubscription(location, clientRequestId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new QuotaUsageResultImpl(inner1, this.manager())); + } + + private UsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.search.SearchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/package-info.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/package-info.java new file mode 100644 index 0000000000000..d95fda6659a8e --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for SearchManagementClient. + * Client that can be used to manage Azure AI Search services and API keys. + */ +package com.azure.resourcemanager.search.implementation; diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AadAuthFailureMode.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AadAuthFailureMode.java new file mode 100644 index 0000000000000..1d52a665a78d6 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AadAuthFailureMode.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Describes what response the data plane API of a search service would send for requests that failed authentication. + */ +public enum AadAuthFailureMode { + /** + * Enum value http403. + */ + HTTP403("http403"), + + /** + * Enum value http401WithBearerChallenge. + */ + HTTP401WITH_BEARER_CHALLENGE("http401WithBearerChallenge"); + + /** + * The actual serialized value for a AadAuthFailureMode instance. + */ + private final String value; + + AadAuthFailureMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AadAuthFailureMode instance. + * + * @param value the serialized value to parse. + * @return the parsed AadAuthFailureMode object, or null if unable to parse. + */ + @JsonCreator + public static AadAuthFailureMode fromString(String value) { + if (value == null) { + return null; + } + AadAuthFailureMode[] items = AadAuthFailureMode.values(); + for (AadAuthFailureMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyKind.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyKind.java new file mode 100644 index 0000000000000..79e0e0d27eb01 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyKind.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AdminKeyKind. + */ +public enum AdminKeyKind { + /** + * Enum value primary. + */ + PRIMARY("primary"), + + /** + * Enum value secondary. + */ + SECONDARY("secondary"); + + /** + * The actual serialized value for a AdminKeyKind instance. + */ + private final String value; + + AdminKeyKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AdminKeyKind instance. + * + * @param value the serialized value to parse. + * @return the parsed AdminKeyKind object, or null if unable to parse. + */ + @JsonCreator + public static AdminKeyKind fromString(String value) { + if (value == null) { + return null; + } + AdminKeyKind[] items = AdminKeyKind.values(); + for (AdminKeyKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyResult.java new file mode 100644 index 0000000000000..665c6d1397327 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyResult.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.resourcemanager.search.fluent.models.AdminKeyResultInner; + +/** + * An immutable client-side representation of AdminKeyResult. + */ +public interface AdminKeyResult { + /** + * Gets the primaryKey property: The primary admin API key of the search service. + * + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * Gets the secondaryKey property: The secondary admin API key of the search service. + * + * @return the secondaryKey value. + */ + String secondaryKey(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.AdminKeyResultInner object. + * + * @return the inner object. + */ + AdminKeyResultInner innerModel(); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeys.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeys.java new file mode 100644 index 0000000000000..3ab70edb4bc4b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeys.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of AdminKeys. + */ +public interface AdminKeys { + /** + * Gets the primary and secondary admin API keys for the specified Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the primary and secondary admin API keys for the specified Azure AI Search service along with + * {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String searchServiceName, UUID clientRequestId, + Context context); + + /** + * Gets the primary and secondary admin API keys for the specified Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the primary and secondary admin API keys for the specified Azure AI Search service. + */ + AdminKeyResult get(String resourceGroupName, String searchServiceName); + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the primary and secondary admin API keys for a given Azure AI Search service along + * with {@link Response}. + */ + Response regenerateWithResponse(String resourceGroupName, String searchServiceName, + AdminKeyKind keyKind, UUID clientRequestId, Context context); + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the primary and secondary admin API keys for a given Azure AI Search service. + */ + AdminKeyResult regenerate(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityInput.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityInput.java new file mode 100644 index 0000000000000..41d043810ea57 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityInput.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input of check name availability API. + */ +@Fluent +public final class CheckNameAvailabilityInput { + /* + * The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The type of the resource whose name is to be validated. This value must always be 'searchServices'. + */ + @JsonProperty(value = "type", required = true) + private String type = "searchServices"; + + /** + * Creates an instance of CheckNameAvailabilityInput class. + */ + public CheckNameAvailabilityInput() { + } + + /** + * Get the name property: The search service name to validate. Search service names must only contain lowercase + * letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive + * dashes, and must be between 2 and 60 characters in length. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The search service name to validate. Search service names must only contain lowercase + * letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive + * dashes, and must be between 2 and 60 characters in length. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityInput object itself. + */ + public CheckNameAvailabilityInput withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type of the resource whose name is to be validated. This value must always be + * 'searchServices'. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of the resource whose name is to be validated. This value must always be + * 'searchServices'. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityInput object itself. + */ + public CheckNameAvailabilityInput withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property name in model CheckNameAvailabilityInput")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailabilityInput.class); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityOutput.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityOutput.java new file mode 100644 index 0000000000000..d6c077997c031 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityOutput.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.resourcemanager.search.fluent.models.CheckNameAvailabilityOutputInner; + +/** + * An immutable client-side representation of CheckNameAvailabilityOutput. + */ +public interface CheckNameAvailabilityOutput { + /** + * Gets the isNameAvailable property: A value indicating whether the name is available. + * + * @return the isNameAvailable value. + */ + Boolean isNameAvailable(); + + /** + * Gets the reason property: The reason why the name is not available. 'Invalid' indicates the name provided does + * not match the naming requirements (incorrect length, unsupported characters, etc.). 'AlreadyExists' indicates + * that the name is already in use and is therefore unavailable. + * + * @return the reason value. + */ + UnavailableNameReason reason(); + + /** + * Gets the message property: A message that explains why the name is invalid and provides resource naming + * requirements. Available only if 'Invalid' is returned in the 'reason' property. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.CheckNameAvailabilityOutputInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityOutputInner innerModel(); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/DataPlaneAadOrApiKeyAuthOption.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/DataPlaneAadOrApiKeyAuthOption.java new file mode 100644 index 0000000000000..98338f157aac5 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/DataPlaneAadOrApiKeyAuthOption.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Indicates that either the API key or an access token from a Microsoft Entra ID tenant can be used for authentication. + */ +@Fluent +public final class DataPlaneAadOrApiKeyAuthOption { + /* + * Describes what response the data plane API of a search service would send for requests that failed authentication. + */ + @JsonProperty(value = "aadAuthFailureMode") + private AadAuthFailureMode aadAuthFailureMode; + + /** + * Creates an instance of DataPlaneAadOrApiKeyAuthOption class. + */ + public DataPlaneAadOrApiKeyAuthOption() { + } + + /** + * Get the aadAuthFailureMode property: Describes what response the data plane API of a search service would send + * for requests that failed authentication. + * + * @return the aadAuthFailureMode value. + */ + public AadAuthFailureMode aadAuthFailureMode() { + return this.aadAuthFailureMode; + } + + /** + * Set the aadAuthFailureMode property: Describes what response the data plane API of a search service would send + * for requests that failed authentication. + * + * @param aadAuthFailureMode the aadAuthFailureMode value to set. + * @return the DataPlaneAadOrApiKeyAuthOption object itself. + */ + public DataPlaneAadOrApiKeyAuthOption withAadAuthFailureMode(AadAuthFailureMode aadAuthFailureMode) { + this.aadAuthFailureMode = aadAuthFailureMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/DataPlaneAuthOptions.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/DataPlaneAuthOptions.java new file mode 100644 index 0000000000000..46cfbd2effead --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/DataPlaneAuthOptions.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines the options for how the search service authenticates a data plane request. This cannot be set if + * 'disableLocalAuth' is set to true. + */ +@Fluent +public final class DataPlaneAuthOptions { + /* + * Indicates that only the API key can be used for authentication. + */ + @JsonProperty(value = "apiKeyOnly") + private Object apiKeyOnly; + + /* + * Indicates that either the API key or an access token from a Microsoft Entra ID tenant can be used for authentication. + */ + @JsonProperty(value = "aadOrApiKey") + private DataPlaneAadOrApiKeyAuthOption aadOrApiKey; + + /** + * Creates an instance of DataPlaneAuthOptions class. + */ + public DataPlaneAuthOptions() { + } + + /** + * Get the apiKeyOnly property: Indicates that only the API key can be used for authentication. + * + * @return the apiKeyOnly value. + */ + public Object apiKeyOnly() { + return this.apiKeyOnly; + } + + /** + * Set the apiKeyOnly property: Indicates that only the API key can be used for authentication. + * + * @param apiKeyOnly the apiKeyOnly value to set. + * @return the DataPlaneAuthOptions object itself. + */ + public DataPlaneAuthOptions withApiKeyOnly(Object apiKeyOnly) { + this.apiKeyOnly = apiKeyOnly; + return this; + } + + /** + * Get the aadOrApiKey property: Indicates that either the API key or an access token from a Microsoft Entra ID + * tenant can be used for authentication. + * + * @return the aadOrApiKey value. + */ + public DataPlaneAadOrApiKeyAuthOption aadOrApiKey() { + return this.aadOrApiKey; + } + + /** + * Set the aadOrApiKey property: Indicates that either the API key or an access token from a Microsoft Entra ID + * tenant can be used for authentication. + * + * @param aadOrApiKey the aadOrApiKey value to set. + * @return the DataPlaneAuthOptions object itself. + */ + public DataPlaneAuthOptions withAadOrApiKey(DataPlaneAadOrApiKeyAuthOption aadOrApiKey) { + this.aadOrApiKey = aadOrApiKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (aadOrApiKey() != null) { + aadOrApiKey().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/EncryptionWithCmk.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/EncryptionWithCmk.java new file mode 100644 index 0000000000000..fc39a865eacdd --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/EncryptionWithCmk.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a policy that determines how resources within the search service are to be encrypted with customer managed + * keys. + */ +@Fluent +public final class EncryptionWithCmk { + /* + * Describes how a search service should enforce compliance if it finds objects that aren't encrypted with the customer-managed key. + */ + @JsonProperty(value = "enforcement") + private SearchEncryptionWithCmk enforcement; + + /* + * Returns the status of search service compliance with respect to non-CMK-encrypted objects. If a service has more than one unencrypted object, and enforcement is enabled, the service is marked as noncompliant. + */ + @JsonProperty(value = "encryptionComplianceStatus", access = JsonProperty.Access.WRITE_ONLY) + private SearchEncryptionComplianceStatus encryptionComplianceStatus; + + /** + * Creates an instance of EncryptionWithCmk class. + */ + public EncryptionWithCmk() { + } + + /** + * Get the enforcement property: Describes how a search service should enforce compliance if it finds objects that + * aren't encrypted with the customer-managed key. + * + * @return the enforcement value. + */ + public SearchEncryptionWithCmk enforcement() { + return this.enforcement; + } + + /** + * Set the enforcement property: Describes how a search service should enforce compliance if it finds objects that + * aren't encrypted with the customer-managed key. + * + * @param enforcement the enforcement value to set. + * @return the EncryptionWithCmk object itself. + */ + public EncryptionWithCmk withEnforcement(SearchEncryptionWithCmk enforcement) { + this.enforcement = enforcement; + return this; + } + + /** + * Get the encryptionComplianceStatus property: Returns the status of search service compliance with respect to + * non-CMK-encrypted objects. If a service has more than one unencrypted object, and enforcement is enabled, the + * service is marked as noncompliant. + * + * @return the encryptionComplianceStatus value. + */ + public SearchEncryptionComplianceStatus encryptionComplianceStatus() { + return this.encryptionComplianceStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/HostingMode.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/HostingMode.java new file mode 100644 index 0000000000000..3375e9c8bb741 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/HostingMode.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow + * up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU. For the standard3 SKU, + * the value is either 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. + */ +public enum HostingMode { + /** + * Enum value default. + */ + DEFAULT("default"), + + /** + * Enum value highDensity. + */ + HIGH_DENSITY("highDensity"); + + /** + * The actual serialized value for a HostingMode instance. + */ + private final String value; + + HostingMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a HostingMode instance. + * + * @param value the serialized value to parse. + * @return the parsed HostingMode object, or null if unable to parse. + */ + @JsonCreator + public static HostingMode fromString(String value) { + if (value == null) { + return null; + } + HostingMode[] items = HostingMode.values(); + for (HostingMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Identity.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Identity.java new file mode 100644 index 0000000000000..85d5542eb5cdd --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Identity.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * Details about the search service identity. A null value indicates that the search service has no identity assigned. + */ +@Fluent +public final class Identity { + /* + * The principal ID of the system-assigned identity of the search service. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of the system-assigned identity of the search service. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an identity created by the system and a set of user assigned identities. The type 'None' will remove all identities from the service. + */ + @JsonProperty(value = "type", required = true) + private IdentityType type; + + /* + * The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Creates an instance of Identity class. + */ + public Identity() { + } + + /** + * Get the principalId property: The principal ID of the system-assigned identity of the search service. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system-assigned identity of the search service. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' + * includes both an identity created by the system and a set of user assigned identities. The type 'None' will + * remove all identities from the service. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' + * includes both an identity created by the system and a set of user assigned identities. The type 'None' will + * remove all identities from the service. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be ARM resource IDs in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be ARM resource IDs in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the Identity object itself. + */ + public Identity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model Identity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Identity.class); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IdentityType.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IdentityType.java new file mode 100644 index 0000000000000..361a8462d6515 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IdentityType.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an identity created + * by the system and a set of user assigned identities. The type 'None' will remove all identities from the service. + */ +public final class IdentityType extends ExpandableStringEnum { + /** + * Static value None for IdentityType. + */ + public static final IdentityType NONE = fromString("None"); + + /** + * Static value SystemAssigned for IdentityType. + */ + public static final IdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value UserAssigned for IdentityType. + */ + public static final IdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Static value SystemAssigned, UserAssigned for IdentityType. + */ + public static final IdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = fromString("SystemAssigned, UserAssigned"); + + /** + * Creates a new instance of IdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IdentityType() { + } + + /** + * Creates or finds a IdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding IdentityType. + */ + @JsonCreator + public static IdentityType fromString(String name) { + return fromString(name, IdentityType.class); + } + + /** + * Gets known IdentityType values. + * + * @return known IdentityType values. + */ + public static Collection values() { + return values(IdentityType.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IpRule.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IpRule.java new file mode 100644 index 0000000000000..58186f3a4cca0 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IpRule.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The IP restriction rule of the Azure AI Search service. + */ +@Fluent +public final class IpRule { + /* + * Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR format (eg., 123.1.2.3/24) to be allowed. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Creates an instance of IpRule class. + */ + public IpRule() { + } + + /** + * Get the value property: Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR + * format (eg., 123.1.2.3/24) to be allowed. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR + * format (eg., 123.1.2.3/24) to be allowed. + * + * @param value the value value to set. + * @return the IpRule object itself. + */ + public IpRule withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ListQueryKeysResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ListQueryKeysResult.java new file mode 100644 index 0000000000000..61cb133fc3d8e --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ListQueryKeysResult.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.search.fluent.models.QueryKeyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Response containing the query API keys for a given Azure AI Search service. + */ +@Immutable +public final class ListQueryKeysResult { + /* + * The query keys for the Azure AI Search service. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of query keys. Returned when the total number of requested query keys exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of ListQueryKeysResult class. + */ + public ListQueryKeysResult() { + } + + /** + * Get the value property: The query keys for the Azure AI Search service. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Request URL that can be used to query next page of query keys. Returned when the total + * number of requested query keys exceed maximum page size. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkRuleSet.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkRuleSet.java new file mode 100644 index 0000000000000..9f58c0b990ed2 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkRuleSet.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Network specific rules that determine how the Azure AI Search service may be reached. + */ +@Fluent +public final class NetworkRuleSet { + /* + * A list of IP restriction rules that defines the inbound network(s) with allowing access to the search service endpoint. At the meantime, all other public IP networks are blocked by the firewall. These restriction rules are applied only when the 'publicNetworkAccess' of the search service is 'enabled'; otherwise, traffic over public interface is not allowed even with any public IP rules, and private endpoint connections would be the exclusive access method. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /* + * Possible origins of inbound traffic that can bypass the rules defined in the 'ipRules' section. + */ + @JsonProperty(value = "bypass") + private SearchBypass bypass; + + /** + * Creates an instance of NetworkRuleSet class. + */ + public NetworkRuleSet() { + } + + /** + * Get the ipRules property: A list of IP restriction rules that defines the inbound network(s) with allowing access + * to the search service endpoint. At the meantime, all other public IP networks are blocked by the firewall. These + * restriction rules are applied only when the 'publicNetworkAccess' of the search service is 'enabled'; otherwise, + * traffic over public interface is not allowed even with any public IP rules, and private endpoint connections + * would be the exclusive access method. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: A list of IP restriction rules that defines the inbound network(s) with allowing access + * to the search service endpoint. At the meantime, all other public IP networks are blocked by the firewall. These + * restriction rules are applied only when the 'publicNetworkAccess' of the search service is 'enabled'; otherwise, + * traffic over public interface is not allowed even with any public IP rules, and private endpoint connections + * would be the exclusive access method. + * + * @param ipRules the ipRules value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the bypass property: Possible origins of inbound traffic that can bypass the rules defined in the 'ipRules' + * section. + * + * @return the bypass value. + */ + public SearchBypass bypass() { + return this.bypass; + } + + /** + * Set the bypass property: Possible origins of inbound traffic that can bypass the rules defined in the 'ipRules' + * section. + * + * @param bypass the bypass value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withBypass(SearchBypass bypass) { + this.bypass = bypass; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkSecurityPerimeterConfiguration.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkSecurityPerimeterConfiguration.java new file mode 100644 index 0000000000000..8d8d74a196014 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkSecurityPerimeterConfiguration.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.resourcemanager.search.fluent.models.NetworkSecurityPerimeterConfigurationInner; +import java.util.List; + +/** + * An immutable client-side representation of NetworkSecurityPerimeterConfiguration. + */ +public interface NetworkSecurityPerimeterConfiguration { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the networkSecurityPerimeter property: The perimeter for a network security perimeter configuration. + * + * @return the networkSecurityPerimeter value. + */ + NspConfigPerimeter networkSecurityPerimeter(); + + /** + * Gets the resourceAssociation property: The resource association for the network security perimeter. + * + * @return the resourceAssociation value. + */ + NspConfigAssociation resourceAssociation(); + + /** + * Gets the profile property: The profile for a network security perimeter configuration. + * + * @return the profile value. + */ + NspConfigProfile profile(); + + /** + * Gets the provisioningIssues property: The provisioningIssues property. + * + * @return the provisioningIssues value. + */ + List provisioningIssues(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.NetworkSecurityPerimeterConfigurationInner object. + * + * @return the inner object. + */ + NetworkSecurityPerimeterConfigurationInner innerModel(); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkSecurityPerimeterConfigurationListResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkSecurityPerimeterConfigurationListResult.java new file mode 100644 index 0000000000000..f899ba5a4ce80 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkSecurityPerimeterConfigurationListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.search.fluent.models.NetworkSecurityPerimeterConfigurationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of network security perimeter configurations for a server. + */ +@Immutable +public final class NetworkSecurityPerimeterConfigurationListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of NetworkSecurityPerimeterConfigurationListResult class. + */ + public NetworkSecurityPerimeterConfigurationListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkSecurityPerimeterConfigurations.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkSecurityPerimeterConfigurations.java new file mode 100644 index 0000000000000..9f4c1827095b2 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkSecurityPerimeterConfigurations.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of NetworkSecurityPerimeterConfigurations. + */ +public interface NetworkSecurityPerimeterConfigurations { + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByService(String resourceGroupName, + String searchServiceName); + + /** + * Gets a list of network security perimeter configurations for a search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of network security perimeter configurations for a search service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByService(String resourceGroupName, + String searchServiceName, Context context); + + /** + * Gets a network security perimeter configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a network security perimeter configuration along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String searchServiceName, + String nspConfigName, Context context); + + /** + * Gets a network security perimeter configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a network security perimeter configuration. + */ + NetworkSecurityPerimeterConfiguration get(String resourceGroupName, String searchServiceName, String nspConfigName); + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reconcile(String resourceGroupName, String searchServiceName, String nspConfigName); + + /** + * Reconcile network security perimeter configuration for the Azure AI Search resource provider. This triggers a + * manual resync with network security perimeter configurations by ensuring the search service carries the latest + * configuration. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param nspConfigName The network security configuration name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void reconcile(String resourceGroupName, String searchServiceName, String nspConfigName, Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigAccessRule.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigAccessRule.java new file mode 100644 index 0000000000000..a24387f8dfcf8 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigAccessRule.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An access rule for a network security perimeter configuration. + */ +@Fluent +public final class NspConfigAccessRule { + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The properties for the access rules in a network security perimeter configuration. + */ + @JsonProperty(value = "properties") + private NspConfigAccessRuleProperties properties; + + /** + * Creates an instance of NspConfigAccessRule class. + */ + public NspConfigAccessRule() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the NspConfigAccessRule object itself. + */ + public NspConfigAccessRule withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: The properties for the access rules in a network security perimeter configuration. + * + * @return the properties value. + */ + public NspConfigAccessRuleProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties for the access rules in a network security perimeter configuration. + * + * @param properties the properties value to set. + * @return the NspConfigAccessRule object itself. + */ + public NspConfigAccessRule withProperties(NspConfigAccessRuleProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigAccessRuleProperties.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigAccessRuleProperties.java new file mode 100644 index 0000000000000..565cfa1a6f18b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigAccessRuleProperties.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The properties for the access rules in a network security perimeter configuration. + */ +@Fluent +public final class NspConfigAccessRuleProperties { + /* + * The direction property. + */ + @JsonProperty(value = "direction") + private String direction; + + /* + * The addressPrefixes property. + */ + @JsonProperty(value = "addressPrefixes") + private List addressPrefixes; + + /* + * The fullyQualifiedDomainNames property. + */ + @JsonProperty(value = "fullyQualifiedDomainNames") + private List fullyQualifiedDomainNames; + + /* + * The subscriptions property. + */ + @JsonProperty(value = "subscriptions") + private List subscriptions; + + /* + * The networkSecurityPerimeters property. + */ + @JsonProperty(value = "networkSecurityPerimeters") + private List networkSecurityPerimeters; + + /** + * Creates an instance of NspConfigAccessRuleProperties class. + */ + public NspConfigAccessRuleProperties() { + } + + /** + * Get the direction property: The direction property. + * + * @return the direction value. + */ + public String direction() { + return this.direction; + } + + /** + * Set the direction property: The direction property. + * + * @param direction the direction value to set. + * @return the NspConfigAccessRuleProperties object itself. + */ + public NspConfigAccessRuleProperties withDirection(String direction) { + this.direction = direction; + return this; + } + + /** + * Get the addressPrefixes property: The addressPrefixes property. + * + * @return the addressPrefixes value. + */ + public List addressPrefixes() { + return this.addressPrefixes; + } + + /** + * Set the addressPrefixes property: The addressPrefixes property. + * + * @param addressPrefixes the addressPrefixes value to set. + * @return the NspConfigAccessRuleProperties object itself. + */ + public NspConfigAccessRuleProperties withAddressPrefixes(List addressPrefixes) { + this.addressPrefixes = addressPrefixes; + return this; + } + + /** + * Get the fullyQualifiedDomainNames property: The fullyQualifiedDomainNames property. + * + * @return the fullyQualifiedDomainNames value. + */ + public List fullyQualifiedDomainNames() { + return this.fullyQualifiedDomainNames; + } + + /** + * Set the fullyQualifiedDomainNames property: The fullyQualifiedDomainNames property. + * + * @param fullyQualifiedDomainNames the fullyQualifiedDomainNames value to set. + * @return the NspConfigAccessRuleProperties object itself. + */ + public NspConfigAccessRuleProperties withFullyQualifiedDomainNames(List fullyQualifiedDomainNames) { + this.fullyQualifiedDomainNames = fullyQualifiedDomainNames; + return this; + } + + /** + * Get the subscriptions property: The subscriptions property. + * + * @return the subscriptions value. + */ + public List subscriptions() { + return this.subscriptions; + } + + /** + * Set the subscriptions property: The subscriptions property. + * + * @param subscriptions the subscriptions value to set. + * @return the NspConfigAccessRuleProperties object itself. + */ + public NspConfigAccessRuleProperties withSubscriptions(List subscriptions) { + this.subscriptions = subscriptions; + return this; + } + + /** + * Get the networkSecurityPerimeters property: The networkSecurityPerimeters property. + * + * @return the networkSecurityPerimeters value. + */ + public List networkSecurityPerimeters() { + return this.networkSecurityPerimeters; + } + + /** + * Set the networkSecurityPerimeters property: The networkSecurityPerimeters property. + * + * @param networkSecurityPerimeters the networkSecurityPerimeters value to set. + * @return the NspConfigAccessRuleProperties object itself. + */ + public NspConfigAccessRuleProperties + withNetworkSecurityPerimeters(List networkSecurityPerimeters) { + this.networkSecurityPerimeters = networkSecurityPerimeters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkSecurityPerimeters() != null) { + networkSecurityPerimeters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigAssociation.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigAssociation.java new file mode 100644 index 0000000000000..57e318b899bfb --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigAssociation.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource association for the network security perimeter. + */ +@Fluent +public final class NspConfigAssociation { + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The accessMode property. + */ + @JsonProperty(value = "accessMode") + private String accessMode; + + /** + * Creates an instance of NspConfigAssociation class. + */ + public NspConfigAssociation() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the NspConfigAssociation object itself. + */ + public NspConfigAssociation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the accessMode property: The accessMode property. + * + * @return the accessMode value. + */ + public String accessMode() { + return this.accessMode; + } + + /** + * Set the accessMode property: The accessMode property. + * + * @param accessMode the accessMode value to set. + * @return the NspConfigAssociation object itself. + */ + public NspConfigAssociation withAccessMode(String accessMode) { + this.accessMode = accessMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigNetworkSecurityPerimeterRule.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigNetworkSecurityPerimeterRule.java new file mode 100644 index 0000000000000..78035c9147314 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigNetworkSecurityPerimeterRule.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The network security perimeter properties present in a configuration rule. + */ +@Fluent +public final class NspConfigNetworkSecurityPerimeterRule { + /* + * The id property. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The perimeterGuid property. + */ + @JsonProperty(value = "perimeterGuid") + private String perimeterGuid; + + /* + * The location property. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Creates an instance of NspConfigNetworkSecurityPerimeterRule class. + */ + public NspConfigNetworkSecurityPerimeterRule() { + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The id property. + * + * @param id the id value to set. + * @return the NspConfigNetworkSecurityPerimeterRule object itself. + */ + public NspConfigNetworkSecurityPerimeterRule withId(String id) { + this.id = id; + return this; + } + + /** + * Get the perimeterGuid property: The perimeterGuid property. + * + * @return the perimeterGuid value. + */ + public String perimeterGuid() { + return this.perimeterGuid; + } + + /** + * Set the perimeterGuid property: The perimeterGuid property. + * + * @param perimeterGuid the perimeterGuid value to set. + * @return the NspConfigNetworkSecurityPerimeterRule object itself. + */ + public NspConfigNetworkSecurityPerimeterRule withPerimeterGuid(String perimeterGuid) { + this.perimeterGuid = perimeterGuid; + return this; + } + + /** + * Get the location property: The location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location property. + * + * @param location the location value to set. + * @return the NspConfigNetworkSecurityPerimeterRule object itself. + */ + public NspConfigNetworkSecurityPerimeterRule withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigPerimeter.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigPerimeter.java new file mode 100644 index 0000000000000..1c5d575c788c3 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigPerimeter.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The perimeter for a network security perimeter configuration. + */ +@Fluent +public final class NspConfigPerimeter { + /* + * The id property. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The perimeterGuid property. + */ + @JsonProperty(value = "perimeterGuid") + private String perimeterGuid; + + /* + * The location property. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Creates an instance of NspConfigPerimeter class. + */ + public NspConfigPerimeter() { + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The id property. + * + * @param id the id value to set. + * @return the NspConfigPerimeter object itself. + */ + public NspConfigPerimeter withId(String id) { + this.id = id; + return this; + } + + /** + * Get the perimeterGuid property: The perimeterGuid property. + * + * @return the perimeterGuid value. + */ + public String perimeterGuid() { + return this.perimeterGuid; + } + + /** + * Set the perimeterGuid property: The perimeterGuid property. + * + * @param perimeterGuid the perimeterGuid value to set. + * @return the NspConfigPerimeter object itself. + */ + public NspConfigPerimeter withPerimeterGuid(String perimeterGuid) { + this.perimeterGuid = perimeterGuid; + return this; + } + + /** + * Get the location property: The location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location property. + * + * @param location the location value to set. + * @return the NspConfigPerimeter object itself. + */ + public NspConfigPerimeter withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigProfile.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigProfile.java new file mode 100644 index 0000000000000..eefdef83e6a09 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspConfigProfile.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The profile for a network security perimeter configuration. + */ +@Fluent +public final class NspConfigProfile { + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The accessRulesVersion property. + */ + @JsonProperty(value = "accessRulesVersion") + private String accessRulesVersion; + + /* + * The accessRules property. + */ + @JsonProperty(value = "accessRules") + private List accessRules; + + /** + * Creates an instance of NspConfigProfile class. + */ + public NspConfigProfile() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the NspConfigProfile object itself. + */ + public NspConfigProfile withName(String name) { + this.name = name; + return this; + } + + /** + * Get the accessRulesVersion property: The accessRulesVersion property. + * + * @return the accessRulesVersion value. + */ + public String accessRulesVersion() { + return this.accessRulesVersion; + } + + /** + * Set the accessRulesVersion property: The accessRulesVersion property. + * + * @param accessRulesVersion the accessRulesVersion value to set. + * @return the NspConfigProfile object itself. + */ + public NspConfigProfile withAccessRulesVersion(String accessRulesVersion) { + this.accessRulesVersion = accessRulesVersion; + return this; + } + + /** + * Get the accessRules property: The accessRules property. + * + * @return the accessRules value. + */ + public List accessRules() { + return this.accessRules; + } + + /** + * Set the accessRules property: The accessRules property. + * + * @param accessRules the accessRules value to set. + * @return the NspConfigProfile object itself. + */ + public NspConfigProfile withAccessRules(List accessRules) { + this.accessRules = accessRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (accessRules() != null) { + accessRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspProvisioningIssue.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspProvisioningIssue.java new file mode 100644 index 0000000000000..17ea84ab6c986 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspProvisioningIssue.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object to describe any issues with provisioning network security perimeters to a search service. + */ +@Fluent +public final class NspProvisioningIssue { + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The properties to describe any issues with provisioning network security perimeters to a search service. + */ + @JsonProperty(value = "properties") + private NspProvisioningIssueProperties properties; + + /** + * Creates an instance of NspProvisioningIssue class. + */ + public NspProvisioningIssue() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the NspProvisioningIssue object itself. + */ + public NspProvisioningIssue withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: The properties to describe any issues with provisioning network security perimeters + * to a search service. + * + * @return the properties value. + */ + public NspProvisioningIssueProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties to describe any issues with provisioning network security perimeters + * to a search service. + * + * @param properties the properties value to set. + * @return the NspProvisioningIssue object itself. + */ + public NspProvisioningIssue withProperties(NspProvisioningIssueProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspProvisioningIssueProperties.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspProvisioningIssueProperties.java new file mode 100644 index 0000000000000..9a36e5d4038c5 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NspProvisioningIssueProperties.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The properties to describe any issues with provisioning network security perimeters to a search service. + */ +@Fluent +public final class NspProvisioningIssueProperties { + /* + * The issueType property. + */ + @JsonProperty(value = "issueType") + private String issueType; + + /* + * The severity property. + */ + @JsonProperty(value = "severity") + private String severity; + + /* + * The description property. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The suggestedResourceIds property. + */ + @JsonProperty(value = "suggestedResourceIds") + private List suggestedResourceIds; + + /* + * The suggestedAccessRules property. + */ + @JsonProperty(value = "suggestedAccessRules") + private List suggestedAccessRules; + + /** + * Creates an instance of NspProvisioningIssueProperties class. + */ + public NspProvisioningIssueProperties() { + } + + /** + * Get the issueType property: The issueType property. + * + * @return the issueType value. + */ + public String issueType() { + return this.issueType; + } + + /** + * Set the issueType property: The issueType property. + * + * @param issueType the issueType value to set. + * @return the NspProvisioningIssueProperties object itself. + */ + public NspProvisioningIssueProperties withIssueType(String issueType) { + this.issueType = issueType; + return this; + } + + /** + * Get the severity property: The severity property. + * + * @return the severity value. + */ + public String severity() { + return this.severity; + } + + /** + * Set the severity property: The severity property. + * + * @param severity the severity value to set. + * @return the NspProvisioningIssueProperties object itself. + */ + public NspProvisioningIssueProperties withSeverity(String severity) { + this.severity = severity; + return this; + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description property. + * + * @param description the description value to set. + * @return the NspProvisioningIssueProperties object itself. + */ + public NspProvisioningIssueProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the suggestedResourceIds property: The suggestedResourceIds property. + * + * @return the suggestedResourceIds value. + */ + public List suggestedResourceIds() { + return this.suggestedResourceIds; + } + + /** + * Set the suggestedResourceIds property: The suggestedResourceIds property. + * + * @param suggestedResourceIds the suggestedResourceIds value to set. + * @return the NspProvisioningIssueProperties object itself. + */ + public NspProvisioningIssueProperties withSuggestedResourceIds(List suggestedResourceIds) { + this.suggestedResourceIds = suggestedResourceIds; + return this; + } + + /** + * Get the suggestedAccessRules property: The suggestedAccessRules property. + * + * @return the suggestedAccessRules value. + */ + public List suggestedAccessRules() { + return this.suggestedAccessRules; + } + + /** + * Set the suggestedAccessRules property: The suggestedAccessRules property. + * + * @param suggestedAccessRules the suggestedAccessRules value to set. + * @return the NspProvisioningIssueProperties object itself. + */ + public NspProvisioningIssueProperties withSuggestedAccessRules(List suggestedAccessRules) { + this.suggestedAccessRules = suggestedAccessRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operation.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operation.java new file mode 100644 index 0000000000000..93703e4649261 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operation.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.resourcemanager.search.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation. This name is of the form {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that describes the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the isDataAction property: Describes if the specified operation is a data plane API operation. Operations + * where this value is not true are supported directly by the resource provider. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the origin property: Describes which originating entities are allowed to invoke this operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the properties property: Describes additional properties for this operation. + * + * @return the properties value. + */ + OperationProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationAvailability.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationAvailability.java new file mode 100644 index 0000000000000..97d9984b79044 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationAvailability.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a particular availability for the metric specification. + */ +@Immutable +public final class OperationAvailability { + /* + * The time grain for the dimension. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * The blob duration for the dimension. + */ + @JsonProperty(value = "blobDuration", access = JsonProperty.Access.WRITE_ONLY) + private String blobDuration; + + /** + * Creates an instance of OperationAvailability class. + */ + public OperationAvailability() { + } + + /** + * Get the timeGrain property: The time grain for the dimension. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the blobDuration property: The blob duration for the dimension. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationDisplay.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationDisplay.java new file mode 100644 index 0000000000000..d06b5fcd4dd75 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationDisplay.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that describes the operation. + */ +@Immutable +public final class OperationDisplay { + /* + * The friendly name of the resource provider. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The operation type: read, write, delete, listKeys/action, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The resource type on which the operation is performed. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The friendly name of the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The friendly name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the operation property: The operation type: read, write, delete, listKeys/action, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the resource property: The resource type on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the description property: The friendly name of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationListResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationListResult.java new file mode 100644 index 0000000000000..c1a3aa1fa1738 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationListResult.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.search.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The result of the request to list REST API operations. It contains a list of operations and a URL to get the next set + * of results. + */ +@Immutable +public final class OperationListResult { + /* + * The list of operations by Azure AI Search, some supported by the resource provider and others by data plane APIs. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URL to get the next set of operation list results, if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: The list of operations by Azure AI Search, some supported by the resource provider and + * others by data plane APIs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URL to get the next set of operation list results, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationLogsSpecification.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationLogsSpecification.java new file mode 100644 index 0000000000000..a7736bffc23f0 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationLogsSpecification.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifications of one type of log for this operation. + */ +@Immutable +public final class OperationLogsSpecification { + /* + * The name of the log specification. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The display name of the log specification. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The blob duration for the log specification. + */ + @JsonProperty(value = "blobDuration", access = JsonProperty.Access.WRITE_ONLY) + private String blobDuration; + + /** + * Creates an instance of OperationLogsSpecification class. + */ + public OperationLogsSpecification() { + } + + /** + * Get the name property: The name of the log specification. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the displayName property: The display name of the log specification. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the blobDuration property: The blob duration for the log specification. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationMetricDimension.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationMetricDimension.java new file mode 100644 index 0000000000000..bb176dc4a103a --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationMetricDimension.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a particular dimension for the metric specification. + */ +@Immutable +public final class OperationMetricDimension { + /* + * The name of the dimension. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The display name of the dimension. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * Creates an instance of OperationMetricDimension class. + */ + public OperationMetricDimension() { + } + + /** + * Get the name property: The name of the dimension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the displayName property: The display name of the dimension. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationMetricsSpecification.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationMetricsSpecification.java new file mode 100644 index 0000000000000..b92bec642d372 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationMetricsSpecification.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Specifications of one type of metric for this operation. + */ +@Immutable +public final class OperationMetricsSpecification { + /* + * The name of the metric specification. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The display name of the metric specification. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The display description of the metric specification. + */ + @JsonProperty(value = "displayDescription", access = JsonProperty.Access.WRITE_ONLY) + private String displayDescription; + + /* + * The unit for the metric specification. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * The type of aggregation for the metric specification. + */ + @JsonProperty(value = "aggregationType", access = JsonProperty.Access.WRITE_ONLY) + private String aggregationType; + + /* + * Dimensions for the metric specification. + */ + @JsonProperty(value = "dimensions", access = JsonProperty.Access.WRITE_ONLY) + private List dimensions; + + /* + * Availabilities for the metric specification. + */ + @JsonProperty(value = "availabilities", access = JsonProperty.Access.WRITE_ONLY) + private List availabilities; + + /** + * Creates an instance of OperationMetricsSpecification class. + */ + public OperationMetricsSpecification() { + } + + /** + * Get the name property: The name of the metric specification. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the displayName property: The display name of the metric specification. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the displayDescription property: The display description of the metric specification. + * + * @return the displayDescription value. + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Get the unit property: The unit for the metric specification. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the aggregationType property: The type of aggregation for the metric specification. + * + * @return the aggregationType value. + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Get the dimensions property: Dimensions for the metric specification. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Get the availabilities property: Availabilities for the metric specification. + * + * @return the availabilities value. + */ + public List availabilities() { + return this.availabilities; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + if (availabilities() != null) { + availabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationProperties.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationProperties.java new file mode 100644 index 0000000000000..13537674a86ca --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationProperties.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes additional properties for this operation. + */ +@Immutable +public final class OperationProperties { + /* + * Specifications of the service for this operation. + */ + @JsonProperty(value = "serviceSpecification", access = JsonProperty.Access.WRITE_ONLY) + private OperationServiceSpecification serviceSpecification; + + /** + * Creates an instance of OperationProperties class. + */ + public OperationProperties() { + } + + /** + * Get the serviceSpecification property: Specifications of the service for this operation. + * + * @return the serviceSpecification value. + */ + public OperationServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceSpecification() != null) { + serviceSpecification().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationServiceSpecification.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationServiceSpecification.java new file mode 100644 index 0000000000000..c98d0d7b66c5c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationServiceSpecification.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Specifications of the service for this operation. + */ +@Immutable +public final class OperationServiceSpecification { + /* + * Specifications of metrics for this operation. + */ + @JsonProperty(value = "metricSpecifications", access = JsonProperty.Access.WRITE_ONLY) + private List metricSpecifications; + + /* + * Specifications of logs for this operation. + */ + @JsonProperty(value = "logSpecifications", access = JsonProperty.Access.WRITE_ONLY) + private List logSpecifications; + + /** + * Creates an instance of OperationServiceSpecification class. + */ + public OperationServiceSpecification() { + } + + /** + * Get the metricSpecifications property: Specifications of metrics for this operation. + * + * @return the metricSpecifications value. + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Get the logSpecifications property: Specifications of logs for this operation. + * + * @return the logSpecifications value. + */ + public List logSpecifications() { + return this.logSpecifications; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metricSpecifications() != null) { + metricSpecifications().forEach(e -> e.validate()); + } + if (logSpecifications() != null) { + logSpecifications().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operations.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operations.java new file mode 100644 index 0000000000000..825f9272d9885 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the request to list REST API operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnection.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..266a5ddf10d43 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnection.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; + +/** + * An immutable client-side representation of PrivateEndpointConnection. + */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Describes the properties of an existing private endpoint connection to the Azure AI + * Search service. + * + * @return the properties value. + */ + PrivateEndpointConnectionProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionListResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..85f00d8df12df --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Response containing a list of private endpoint connections. + */ +@Immutable +public final class PrivateEndpointConnectionListResult { + /* + * The list of private endpoint connections. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested private endpoint connections exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of PrivateEndpointConnectionListResult class. + */ + public PrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: The list of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Request URL that can be used to query next page of private endpoint connections. + * Returned when the total number of requested private endpoint connections exceed maximum page size. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionProperties.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..2f823aaf589d4 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the properties of an existing private endpoint connection to the search service. + */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * The private endpoint resource from Microsoft.Network provider. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointConnectionPropertiesPrivateEndpoint privateEndpoint; + + /* + * Describes the current state of an existing Azure Private Link service connection to the private endpoint. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The group ID of the Azure resource for which the private link service is for. + */ + @JsonProperty(value = "groupId") + private String groupId; + + /* + * The provisioning state of the private link service connection. Valid values are Updating, Deleting, Failed, Succeeded, Incomplete, or Canceled. + */ + @JsonProperty(value = "provisioningState") + private PrivateLinkServiceConnectionProvisioningState provisioningState; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the privateEndpoint property: The private endpoint resource from Microsoft.Network provider. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointConnectionPropertiesPrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The private endpoint resource from Microsoft.Network provider. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties + withPrivateEndpoint(PrivateEndpointConnectionPropertiesPrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Describes the current state of an existing Azure Private Link + * service connection to the private endpoint. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Describes the current state of an existing Azure Private Link + * service connection to the private endpoint. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the groupId property: The group ID of the Azure resource for which the private link service is for. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Set the groupId property: The group ID of the Azure resource for which the private link service is for. + * + * @param groupId the groupId value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private link service connection. Valid values + * are Updating, Deleting, Failed, Succeeded, Incomplete, or Canceled. + * + * @return the provisioningState value. + */ + public PrivateLinkServiceConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The provisioning state of the private link service connection. Valid values + * are Updating, Deleting, Failed, Succeeded, Incomplete, or Canceled. + * + * @param provisioningState the provisioningState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties + withProvisioningState(PrivateLinkServiceConnectionProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateEndpoint.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateEndpoint.java new file mode 100644 index 0000000000000..5557a94e734a4 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateEndpoint.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The private endpoint resource from Microsoft.Network provider. + */ +@Fluent +public final class PrivateEndpointConnectionPropertiesPrivateEndpoint { + /* + * The resource ID of the private endpoint resource from Microsoft.Network provider. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Creates an instance of PrivateEndpointConnectionPropertiesPrivateEndpoint class. + */ + public PrivateEndpointConnectionPropertiesPrivateEndpoint() { + } + + /** + * Get the id property: The resource ID of the private endpoint resource from Microsoft.Network provider. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The resource ID of the private endpoint resource from Microsoft.Network provider. + * + * @param id the id value to set. + * @return the PrivateEndpointConnectionPropertiesPrivateEndpoint object itself. + */ + public PrivateEndpointConnectionPropertiesPrivateEndpoint withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..154b1e545048b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the current state of an existing Azure Private Link service connection to the private endpoint. + */ +@Fluent +public final class PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState { + /* + * Status of the the private link service connection. Valid values are Pending, Approved, Rejected, or Disconnected. + */ + @JsonProperty(value = "status") + private PrivateLinkServiceConnectionStatus status; + + /* + * The description for the private link service connection state. + */ + @JsonProperty(value = "description") + private String description; + + /* + * A description of any extra actions that may be required. + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /** + * Creates an instance of PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState class. + */ + public PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Status of the the private link service connection. Valid values are Pending, Approved, + * Rejected, or Disconnected. + * + * @return the status value. + */ + public PrivateLinkServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the the private link service connection. Valid values are Pending, Approved, + * Rejected, or Disconnected. + * + * @param status the status value to set. + * @return the PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState object itself. + */ + public PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + withStatus(PrivateLinkServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The description for the private link service connection state. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description for the private link service connection state. + * + * @param description the description value to set. + * @return the PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState object itself. + */ + public PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: A description of any extra actions that may be required. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: A description of any extra actions that may be required. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState object itself. + */ + public PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnections.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..56063122f3373 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnections.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import java.util.UUID; + +/** + * Resource collection API of PrivateEndpointConnections. + */ +public interface PrivateEndpointConnections { + /** + * Updates a private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param privateEndpointConnection The definition of the private endpoint connection to update. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response}. + */ + Response updateWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, + UUID clientRequestId, Context context); + + /** + * Updates a private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param privateEndpointConnection The definition of the private endpoint connection to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service. + */ + PrivateEndpointConnection update(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * Gets the details of the private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the private endpoint connection to the search service in the given resource group along + * with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, UUID clientRequestId, Context context); + + /** + * Gets the details of the private endpoint connection to the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the private endpoint connection to the search service in the given resource group. + */ + PrivateEndpointConnection get(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName); + + /** + * Disconnects the private endpoint connection and deletes it from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service along with + * {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName, UUID clientRequestId, Context context); + + /** + * Disconnects the private endpoint connection and deletes it from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure AI Search service + * with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an existing private endpoint connection to the Azure AI Search service. + */ + PrivateEndpointConnection delete(String resourceGroupName, String searchServiceName, + String privateEndpointConnectionName); + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByService(String resourceGroupName, String searchServiceName); + + /** + * Gets a list of all private endpoint connections in the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all private endpoint connections in the given service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResource.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..cd550d995a862 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResource.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.resourcemanager.search.fluent.models.PrivateLinkResourceInner; + +/** + * An immutable client-side representation of PrivateLinkResource. + */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Describes the properties of a supported private link resource for the Azure AI + * Search service. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourceProperties.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..3d5299f991051 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourceProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Describes the properties of a supported private link resource for the Azure AI Search service. For a given API + * version, this represents the 'supported' groupIds when creating a shared private link resource. + */ +@Immutable +public final class PrivateLinkResourceProperties { + /* + * The group ID of the private link resource. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The list of required members of the private link resource. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The list of required DNS zone names of the private link resource. + */ + @JsonProperty(value = "requiredZoneNames", access = JsonProperty.Access.WRITE_ONLY) + private List requiredZoneNames; + + /* + * The list of resources that are onboarded to private link service, that are supported by Azure AI Search. + */ + @JsonProperty(value = "shareablePrivateLinkResourceTypes", access = JsonProperty.Access.WRITE_ONLY) + private List shareablePrivateLinkResourceTypes; + + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + public PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: The group ID of the private link resource. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The list of required members of the private link resource. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The list of required DNS zone names of the private link resource. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Get the shareablePrivateLinkResourceTypes property: The list of resources that are onboarded to private link + * service, that are supported by Azure AI Search. + * + * @return the shareablePrivateLinkResourceTypes value. + */ + public List shareablePrivateLinkResourceTypes() { + return this.shareablePrivateLinkResourceTypes; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (shareablePrivateLinkResourceTypes() != null) { + shareablePrivateLinkResourceTypes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResources.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..acb3da5ae2eb6 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResources.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of PrivateLinkResources. + */ +public interface PrivateLinkResources { + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listSupported(String resourceGroupName, String searchServiceName); + + /** + * Gets a list of all supported private link resource types for the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all supported private link resource types for the given service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listSupported(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourcesResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourcesResult.java new file mode 100644 index 0000000000000..cfe95180ea592 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourcesResult.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.search.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Response containing a list of supported Private Link Resources. + */ +@Immutable +public final class PrivateLinkResourcesResult { + /* + * The list of supported Private Link Resources. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Creates an instance of PrivateLinkResourcesResult class. + */ + public PrivateLinkResourcesResult() { + } + + /** + * Get the value property: The list of supported Private Link Resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkServiceConnectionProvisioningState.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkServiceConnectionProvisioningState.java new file mode 100644 index 0000000000000..f959e8b8e1e10 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkServiceConnectionProvisioningState.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The provisioning state of the private link service connection. Valid values are Updating, Deleting, Failed, + * Succeeded, Incomplete, or Canceled. + */ +public final class PrivateLinkServiceConnectionProvisioningState + extends ExpandableStringEnum { + /** + * Static value Updating for PrivateLinkServiceConnectionProvisioningState. + */ + public static final PrivateLinkServiceConnectionProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for PrivateLinkServiceConnectionProvisioningState. + */ + public static final PrivateLinkServiceConnectionProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Failed for PrivateLinkServiceConnectionProvisioningState. + */ + public static final PrivateLinkServiceConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Succeeded for PrivateLinkServiceConnectionProvisioningState. + */ + public static final PrivateLinkServiceConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Incomplete for PrivateLinkServiceConnectionProvisioningState. + */ + public static final PrivateLinkServiceConnectionProvisioningState INCOMPLETE = fromString("Incomplete"); + + /** + * Static value Canceled for PrivateLinkServiceConnectionProvisioningState. + */ + public static final PrivateLinkServiceConnectionProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of PrivateLinkServiceConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateLinkServiceConnectionProvisioningState() { + } + + /** + * Creates or finds a PrivateLinkServiceConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionProvisioningState. + */ + @JsonCreator + public static PrivateLinkServiceConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionProvisioningState.class); + } + + /** + * Gets known PrivateLinkServiceConnectionProvisioningState values. + * + * @return known PrivateLinkServiceConnectionProvisioningState values. + */ + public static Collection values() { + return values(PrivateLinkServiceConnectionProvisioningState.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkServiceConnectionStatus.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkServiceConnectionStatus.java new file mode 100644 index 0000000000000..e865e7a7864d7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkServiceConnectionStatus.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Status of the the private link service connection. Valid values are Pending, Approved, Rejected, or Disconnected. + */ +public enum PrivateLinkServiceConnectionStatus { + /** + * Enum value Pending. + */ + PENDING("Pending"), + + /** + * Enum value Approved. + */ + APPROVED("Approved"), + + /** + * Enum value Rejected. + */ + REJECTED("Rejected"), + + /** + * Enum value Disconnected. + */ + DISCONNECTED("Disconnected"); + + /** + * The actual serialized value for a PrivateLinkServiceConnectionStatus instance. + */ + private final String value; + + PrivateLinkServiceConnectionStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PrivateLinkServiceConnectionStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed PrivateLinkServiceConnectionStatus object, or null if unable to parse. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStatus fromString(String value) { + if (value == null) { + return null; + } + PrivateLinkServiceConnectionStatus[] items = PrivateLinkServiceConnectionStatus.values(); + for (PrivateLinkServiceConnectionStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ProvisioningState.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ProvisioningState.java new file mode 100644 index 0000000000000..466dba5b2bd53 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * The state of the last provisioning operation performed on the search service. Provisioning is an intermediate state + * that occurs while service capacity is being established. After capacity is set up, provisioningState changes to + * either 'Succeeded' or 'Failed'. Client applications can poll provisioning status (the recommended polling interval is + * from 30 seconds to one minute) by using the Get Search Service operation to see when an operation is completed. If + * you are using the free service, this value tends to come back as 'Succeeded' directly in the call to Create search + * service. This is because the free service uses capacity that is already set up. + */ +public enum ProvisioningState { + /** + * Enum value Succeeded. + */ + SUCCEEDED("Succeeded"), + + /** + * Enum value Provisioning. + */ + PROVISIONING("Provisioning"), + + /** + * Enum value Failed. + */ + FAILED("Failed"); + + /** + * The actual serialized value for a ProvisioningState instance. + */ + private final String value; + + ProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningState fromString(String value) { + if (value == null) { + return null; + } + ProvisioningState[] items = ProvisioningState.values(); + for (ProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PublicNetworkAccess.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..4d089a81e5d8f --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PublicNetworkAccess.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * This value can be set to 'enabled' to avoid breaking changes on existing customer resources and templates. If set to + * 'disabled', traffic over public interface is not allowed, and private endpoint connections would be the exclusive + * access method. + */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** + * Static value enabled for PublicNetworkAccess. + */ + public static final PublicNetworkAccess ENABLED = fromString("enabled"); + + /** + * Static value disabled for PublicNetworkAccess. + */ + public static final PublicNetworkAccess DISABLED = fromString("disabled"); + + /** + * Creates a new instance of PublicNetworkAccess value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicNetworkAccess() { + } + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** + * Gets known PublicNetworkAccess values. + * + * @return known PublicNetworkAccess values. + */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKey.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKey.java new file mode 100644 index 0000000000000..0dac9744c73e6 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKey.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.resourcemanager.search.fluent.models.QueryKeyInner; + +/** + * An immutable client-side representation of QueryKey. + */ +public interface QueryKey { + /** + * Gets the name property: The name of the query API key. Query names are optional, but assigning a name can help + * you remember how it's used. + * + * @return the name value. + */ + String name(); + + /** + * Gets the key property: The value of the query API key. + * + * @return the key value. + */ + String key(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.QueryKeyInner object. + * + * @return the inner object. + */ + QueryKeyInner innerModel(); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKeys.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKeys.java new file mode 100644 index 0000000000000..141a44cc0dea6 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKeys.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of QueryKeys. + */ +public interface QueryKeys { + /** + * Generates a new query key for the specified search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs + * collection of an index along with {@link Response}. + */ + Response createWithResponse(String resourceGroupName, String searchServiceName, String name, + UUID clientRequestId, Context context); + + /** + * Generates a new query key for the specified search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes an API key for a given Azure AI Search service that conveys read-only permissions on the docs + * collection of an index. + */ + QueryKey create(String resourceGroupName, String searchServiceName, String name); + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listBySearchService(String resourceGroupName, String searchServiceName); + + /** + * Returns the list of query API keys for the given Azure AI Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response containing the query API keys for a given Azure AI Search service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listBySearchService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating + * a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String searchServiceName, String key, + UUID clientRequestId, Context context); + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating + * a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String searchServiceName, String key); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QuotaUsageResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QuotaUsageResult.java new file mode 100644 index 0000000000000..a3b1dfabecd98 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QuotaUsageResult.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner; + +/** + * An immutable client-side representation of QuotaUsageResult. + */ +public interface QuotaUsageResult { + /** + * Gets the id property: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider. + * + * @return the id value. + */ + String id(); + + /** + * Gets the unit property: The unit of measurement for the search SKU. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the currentValue property: The currently used up value for the particular search SKU. + * + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * Gets the limit property: The quota limit for the particular search SKU. + * + * @return the limit value. + */ + Integer limit(); + + /** + * Gets the name property: The name of the SKU supported by Azure AI Search. + * + * @return the name value. + */ + QuotaUsageResultName name(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner object. + * + * @return the inner object. + */ + QuotaUsageResultInner innerModel(); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QuotaUsageResultName.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QuotaUsageResultName.java new file mode 100644 index 0000000000000..f3f0d07743e8b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QuotaUsageResultName.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The name of the SKU supported by Azure AI Search. + */ +@Fluent +public final class QuotaUsageResultName { + /* + * The SKU name supported by Azure AI Search. + */ + @JsonProperty(value = "value") + private String value; + + /* + * The localized string value for the SKU name. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Creates an instance of QuotaUsageResultName class. + */ + public QuotaUsageResultName() { + } + + /** + * Get the value property: The SKU name supported by Azure AI Search. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The SKU name supported by Azure AI Search. + * + * @param value the value value to set. + * @return the QuotaUsageResultName object itself. + */ + public QuotaUsageResultName withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: The localized string value for the SKU name. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: The localized string value for the SKU name. + * + * @param localizedValue the localizedValue value to set. + * @return the QuotaUsageResultName object itself. + */ + public QuotaUsageResultName withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QuotaUsagesListResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QuotaUsagesListResult.java new file mode 100644 index 0000000000000..e615bff32f771 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QuotaUsagesListResult.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Response containing the quota usage information for all the supported SKUs of Azure AI Search. + */ +@Immutable +public final class QuotaUsagesListResult { + /* + * The quota usages for the SKUs supported by Azure AI Search. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * 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. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of QuotaUsagesListResult class. + */ + public QuotaUsagesListResult() { + } + + /** + * Get the value property: The quota usages for the SKUs supported by Azure AI Search. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: 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. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ResourceProviders.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ResourceProviders.java new file mode 100644 index 0000000000000..56f2983c859be --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ResourceProviders.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of ResourceProviders. + */ +public interface ResourceProviders { + /** + * Gets the quota usage for a search sku in the given subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param skuName The unique SKU name that identifies a billable tier. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the quota usage for a search sku in the given subscription along with {@link Response}. + */ + Response usageBySubscriptionSkuWithResponse(String location, String skuName, UUID clientRequestId, + Context context); + + /** + * Gets the quota usage for a search sku in the given subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param skuName The unique SKU name that identifies a billable tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the quota usage for a search sku in the given subscription. + */ + QuotaUsageResult usageBySubscriptionSku(String location, String skuName); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchBypass.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchBypass.java new file mode 100644 index 0000000000000..ffa4c7103d6ff --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchBypass.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Possible origins of inbound traffic that can bypass the rules defined in the 'ipRules' section. + */ +public final class SearchBypass extends ExpandableStringEnum { + /** + * Static value None for SearchBypass. + */ + public static final SearchBypass NONE = fromString("None"); + + /** + * Static value AzurePortal for SearchBypass. + */ + public static final SearchBypass AZURE_PORTAL = fromString("AzurePortal"); + + /** + * Static value AzureServices for SearchBypass. + */ + public static final SearchBypass AZURE_SERVICES = fromString("AzureServices"); + + /** + * Creates a new instance of SearchBypass value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SearchBypass() { + } + + /** + * Creates or finds a SearchBypass from its string representation. + * + * @param name a name to look for. + * @return the corresponding SearchBypass. + */ + @JsonCreator + public static SearchBypass fromString(String name) { + return fromString(name, SearchBypass.class); + } + + /** + * Gets known SearchBypass values. + * + * @return known SearchBypass values. + */ + public static Collection values() { + return values(SearchBypass.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchDisabledDataExfiltrationOption.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchDisabledDataExfiltrationOption.java new file mode 100644 index 0000000000000..9969c49964837 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchDisabledDataExfiltrationOption.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * A specific data exfiltration scenario that is disabled for the service. + */ +public final class SearchDisabledDataExfiltrationOption + extends ExpandableStringEnum { + /** + * Static value All for SearchDisabledDataExfiltrationOption. + */ + public static final SearchDisabledDataExfiltrationOption ALL = fromString("All"); + + /** + * Creates a new instance of SearchDisabledDataExfiltrationOption value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SearchDisabledDataExfiltrationOption() { + } + + /** + * Creates or finds a SearchDisabledDataExfiltrationOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding SearchDisabledDataExfiltrationOption. + */ + @JsonCreator + public static SearchDisabledDataExfiltrationOption fromString(String name) { + return fromString(name, SearchDisabledDataExfiltrationOption.class); + } + + /** + * Gets known SearchDisabledDataExfiltrationOption values. + * + * @return known SearchDisabledDataExfiltrationOption values. + */ + public static Collection values() { + return values(SearchDisabledDataExfiltrationOption.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchEncryptionComplianceStatus.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchEncryptionComplianceStatus.java new file mode 100644 index 0000000000000..102f536e6f513 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchEncryptionComplianceStatus.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Returns the status of search service compliance with respect to non-CMK-encrypted objects. If a service has more than + * one unencrypted object, and enforcement is enabled, the service is marked as noncompliant. + */ +public enum SearchEncryptionComplianceStatus { + /** + * Enum value Compliant. + */ + COMPLIANT("Compliant"), + + /** + * Enum value NonCompliant. + */ + NON_COMPLIANT("NonCompliant"); + + /** + * The actual serialized value for a SearchEncryptionComplianceStatus instance. + */ + private final String value; + + SearchEncryptionComplianceStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SearchEncryptionComplianceStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed SearchEncryptionComplianceStatus object, or null if unable to parse. + */ + @JsonCreator + public static SearchEncryptionComplianceStatus fromString(String value) { + if (value == null) { + return null; + } + SearchEncryptionComplianceStatus[] items = SearchEncryptionComplianceStatus.values(); + for (SearchEncryptionComplianceStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchEncryptionWithCmk.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchEncryptionWithCmk.java new file mode 100644 index 0000000000000..a6b17cf2941a2 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchEncryptionWithCmk.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Describes how a search service should enforce compliance if it finds objects that aren't encrypted with the + * customer-managed key. + */ +public enum SearchEncryptionWithCmk { + /** + * Enum value Disabled. + */ + DISABLED("Disabled"), + + /** + * Enum value Enabled. + */ + ENABLED("Enabled"), + + /** + * Enum value Unspecified. + */ + UNSPECIFIED("Unspecified"); + + /** + * The actual serialized value for a SearchEncryptionWithCmk instance. + */ + private final String value; + + SearchEncryptionWithCmk(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SearchEncryptionWithCmk instance. + * + * @param value the serialized value to parse. + * @return the parsed SearchEncryptionWithCmk object, or null if unable to parse. + */ + @JsonCreator + public static SearchEncryptionWithCmk fromString(String value) { + if (value == null) { + return null; + } + SearchEncryptionWithCmk[] items = SearchEncryptionWithCmk.values(); + for (SearchEncryptionWithCmk item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchSemanticSearch.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchSemanticSearch.java new file mode 100644 index 0000000000000..2182794f092a6 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchSemanticSearch.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Sets options that control the availability of semantic search. This configuration is only possible for certain Azure + * AI Search SKUs in certain locations. + */ +public final class SearchSemanticSearch extends ExpandableStringEnum { + /** + * Static value disabled for SearchSemanticSearch. + */ + public static final SearchSemanticSearch DISABLED = fromString("disabled"); + + /** + * Static value free for SearchSemanticSearch. + */ + public static final SearchSemanticSearch FREE = fromString("free"); + + /** + * Static value standard for SearchSemanticSearch. + */ + public static final SearchSemanticSearch STANDARD = fromString("standard"); + + /** + * Creates a new instance of SearchSemanticSearch value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SearchSemanticSearch() { + } + + /** + * Creates or finds a SearchSemanticSearch from its string representation. + * + * @param name a name to look for. + * @return the corresponding SearchSemanticSearch. + */ + @JsonCreator + public static SearchSemanticSearch fromString(String name) { + return fromString(name, SearchSemanticSearch.class); + } + + /** + * Gets known SearchSemanticSearch values. + * + * @return known SearchSemanticSearch values. + */ + public static Collection values() { + return values(SearchSemanticSearch.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchService.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchService.java new file mode 100644 index 0000000000000..a3ccc1ddaa410 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchService.java @@ -0,0 +1,808 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.SearchServiceInner; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * An immutable client-side representation of SearchService. + */ +public interface SearchService { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The SKU of the search service, which determines price tier and capacity limits. This + * property is required when creating a new search service. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the identity property: The identity of the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the replicaCount property: The number of replicas in the search service. If specified, it must be a value + * between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * + * @return the replicaCount value. + */ + Integer replicaCount(); + + /** + * Gets the partitionCount property: The number of partitions in the search service; if specified, it can be 1, 2, + * 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode + * set to 'highDensity', the allowed values are between 1 and 3. + * + * @return the partitionCount value. + */ + Integer partitionCount(); + + /** + * Gets the hostingMode property: Applicable only for the standard3 SKU. You can set this property to enable up to 3 + * high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for + * any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this + * value must be 'default'. + * + * @return the hostingMode value. + */ + HostingMode hostingMode(); + + /** + * Gets the publicNetworkAccess property: This value can be set to 'enabled' to avoid breaking changes on existing + * customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private + * endpoint connections would be the exclusive access method. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccess publicNetworkAccess(); + + /** + * Gets the status property: The status of the search service. Possible values include: 'running': The search + * service is running and no provisioning operations are underway. 'provisioning': The search service is being + * provisioned or scaled up or down. 'deleting': The search service is being deleted. 'degraded': The search service + * is degraded. This can occur when the underlying search units are not healthy. The search service is most likely + * operational, but performance might be slow and some requests might be dropped. 'disabled': The search service is + * disabled. In this state, the service will reject all API requests. 'error': The search service is in an error + * state. 'stopped': The search service is in a subscription that's disabled. If your service is in the degraded, + * disabled, or error states, it means the Azure AI Search team is actively investigating the underlying issue. + * Dedicated services in these states are still chargeable based on the number of search units provisioned. + * + * @return the status value. + */ + SearchServiceStatus status(); + + /** + * Gets the statusDetails property: The details of the search service status. + * + * @return the statusDetails value. + */ + String statusDetails(); + + /** + * Gets the provisioningState property: The state of the last provisioning operation performed on the search + * service. Provisioning is an intermediate state that occurs while service capacity is being established. After + * capacity is set up, provisioningState changes to either 'Succeeded' or 'Failed'. Client applications can poll + * provisioning status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search + * Service operation to see when an operation is completed. If you are using the free service, this value tends to + * come back as 'Succeeded' directly in the call to Create search service. This is because the free service uses + * capacity that is already set up. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the networkRuleSet property: Network specific rules that determine how the Azure AI Search service may be + * reached. + * + * @return the networkRuleSet value. + */ + NetworkRuleSet networkRuleSet(); + + /** + * Gets the disabledDataExfiltrationOptions property: A list of data exfiltration scenarios that are explicitly + * disallowed for the search service. Currently, the only supported value is 'All' to disable all possible data + * export scenarios with more fine grained controls planned for the future. + * + * @return the disabledDataExfiltrationOptions value. + */ + List disabledDataExfiltrationOptions(); + + /** + * Gets the encryptionWithCmk property: Specifies any policy regarding encryption of resources (such as indexes) + * using customer manager keys within a search service. + * + * @return the encryptionWithCmk value. + */ + EncryptionWithCmk encryptionWithCmk(); + + /** + * Gets the disableLocalAuth property: 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. + * + * @return the disableLocalAuth value. + */ + Boolean disableLocalAuth(); + + /** + * Gets the authOptions property: 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. + * + * @return the authOptions value. + */ + DataPlaneAuthOptions authOptions(); + + /** + * Gets the semanticSearch property: Sets options that control the availability of semantic search. This + * configuration is only possible for certain Azure AI Search SKUs in certain locations. + * + * @return the semanticSearch value. + */ + SearchSemanticSearch semanticSearch(); + + /** + * Gets the privateEndpointConnections property: The list of private endpoint connections to the Azure AI Search + * service. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the sharedPrivateLinkResources property: The list of shared private link resources managed by the Azure AI + * Search service. + * + * @return the sharedPrivateLinkResources value. + */ + List sharedPrivateLinkResources(); + + /** + * Gets the etag property: A system generated property representing the service's etag that can be for optimistic + * concurrency control during updates. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.SearchServiceInner object. + * + * @return the inner object. + */ + SearchServiceInner innerModel(); + + /** + * The entirety of the SearchService definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The SearchService definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SearchService definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SearchService definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the SearchService definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the SearchService definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithSku, DefinitionStages.WithIdentity, + DefinitionStages.WithReplicaCount, DefinitionStages.WithPartitionCount, DefinitionStages.WithHostingMode, + DefinitionStages.WithPublicNetworkAccess, DefinitionStages.WithNetworkRuleSet, + DefinitionStages.WithDisabledDataExfiltrationOptions, DefinitionStages.WithEncryptionWithCmk, + DefinitionStages.WithDisableLocalAuth, DefinitionStages.WithAuthOptions, + DefinitionStages.WithSemanticSearch, DefinitionStages.WithClientRequestId { + /** + * Executes the create request. + * + * @return the created resource. + */ + SearchService create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SearchService create(Context context); + } + + /** + * The stage of the SearchService definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the SearchService definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: The SKU of the search service, which determines price tier and capacity + * limits. This property is required when creating a new search service.. + * + * @param sku The SKU of the search service, which determines price tier and capacity limits. This property + * is required when creating a new search service. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the SearchService definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + + /** + * The stage of the SearchService definition allowing to specify replicaCount. + */ + interface WithReplicaCount { + /** + * Specifies the replicaCount property: The number of replicas in the search service. If specified, it must + * be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU.. + * + * @param replicaCount The number of replicas in the search service. If specified, it must be a value + * between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * @return the next definition stage. + */ + WithCreate withReplicaCount(Integer replicaCount); + } + + /** + * The stage of the SearchService definition allowing to specify partitionCount. + */ + interface WithPartitionCount { + /** + * Specifies the partitionCount property: The number of partitions in the search service; if specified, it + * can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' + * services with hostingMode set to 'highDensity', the allowed values are between 1 and 3.. + * + * @param partitionCount The number of partitions in the search service; if specified, it can be 1, 2, 3, 4, + * 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with + * hostingMode set to 'highDensity', the allowed values are between 1 and 3. + * @return the next definition stage. + */ + WithCreate withPartitionCount(Integer partitionCount); + } + + /** + * The stage of the SearchService definition allowing to specify hostingMode. + */ + interface WithHostingMode { + /** + * Specifies the hostingMode property: Applicable only for the standard3 SKU. You can set this property to + * enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the + * maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or + * 'highDensity'. For all other SKUs, this value must be 'default'.. + * + * @param hostingMode Applicable only for the standard3 SKU. You can set this property to enable up to 3 + * high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes + * allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all + * other SKUs, this value must be 'default'. + * @return the next definition stage. + */ + WithCreate withHostingMode(HostingMode hostingMode); + } + + /** + * The stage of the SearchService definition allowing to specify publicNetworkAccess. + */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: This value can be set to 'enabled' to avoid breaking changes + * on existing customer resources and templates. If set to 'disabled', traffic over public interface is not + * allowed, and private endpoint connections would be the exclusive access method.. + * + * @param publicNetworkAccess This value can be set to 'enabled' to avoid breaking changes on existing + * customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and + * private endpoint connections would be the exclusive access method. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + + /** + * The stage of the SearchService definition allowing to specify networkRuleSet. + */ + interface WithNetworkRuleSet { + /** + * Specifies the networkRuleSet property: Network specific rules that determine how the Azure AI Search + * service may be reached.. + * + * @param networkRuleSet Network specific rules that determine how the Azure AI Search service may be + * reached. + * @return the next definition stage. + */ + WithCreate withNetworkRuleSet(NetworkRuleSet networkRuleSet); + } + + /** + * The stage of the SearchService definition allowing to specify disabledDataExfiltrationOptions. + */ + interface WithDisabledDataExfiltrationOptions { + /** + * Specifies the disabledDataExfiltrationOptions property: A list of data exfiltration scenarios that are + * explicitly disallowed for the search service. Currently, the only supported value is 'All' to disable all + * possible data export scenarios with more fine grained controls planned for the future.. + * + * @param disabledDataExfiltrationOptions A list of data exfiltration scenarios that are explicitly + * disallowed for the search service. Currently, the only supported value is 'All' to disable all possible + * data export scenarios with more fine grained controls planned for the future. + * @return the next definition stage. + */ + WithCreate withDisabledDataExfiltrationOptions( + List disabledDataExfiltrationOptions); + } + + /** + * The stage of the SearchService definition allowing to specify encryptionWithCmk. + */ + interface WithEncryptionWithCmk { + /** + * Specifies the encryptionWithCmk property: Specifies any policy regarding encryption of resources (such as + * indexes) using customer manager keys within a search service.. + * + * @param encryptionWithCmk Specifies any policy regarding encryption of resources (such as indexes) using + * customer manager keys within a search service. + * @return the next definition stage. + */ + WithCreate withEncryptionWithCmk(EncryptionWithCmk encryptionWithCmk); + } + + /** + * The stage of the SearchService definition allowing to specify disableLocalAuth. + */ + interface WithDisableLocalAuth { + /** + * Specifies the disableLocalAuth property: 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.. + * + * @param disableLocalAuth 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. + * @return the next definition stage. + */ + WithCreate withDisableLocalAuth(Boolean disableLocalAuth); + } + + /** + * The stage of the SearchService definition allowing to specify authOptions. + */ + interface WithAuthOptions { + /** + * Specifies the authOptions property: 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.. + * + * @param authOptions 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. + * @return the next definition stage. + */ + WithCreate withAuthOptions(DataPlaneAuthOptions authOptions); + } + + /** + * The stage of the SearchService definition allowing to specify semanticSearch. + */ + interface WithSemanticSearch { + /** + * Specifies the semanticSearch property: Sets options that control the availability of semantic search. + * This configuration is only possible for certain Azure AI Search SKUs in certain locations.. + * + * @param semanticSearch Sets options that control the availability of semantic search. This configuration + * is only possible for certain Azure AI Search SKUs in certain locations. + * @return the next definition stage. + */ + WithCreate withSemanticSearch(SearchSemanticSearch semanticSearch); + } + + /** + * The stage of the SearchService definition allowing to specify clientRequestId. + */ + interface WithClientRequestId { + /** + * Specifies the clientRequestId property: A client-generated GUID value that identifies this request. If + * specified, this will be included in response information as a way to track the request.. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this + * will be included in response information as a way to track the request. + * @return the next definition stage. + */ + WithCreate withClientRequestId(UUID clientRequestId); + } + } + + /** + * Begins update for the SearchService resource. + * + * @return the stage of resource update. + */ + SearchService.Update update(); + + /** + * The template for SearchService update. + */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithSku, UpdateStages.WithIdentity, UpdateStages.WithReplicaCount, + UpdateStages.WithPartitionCount, UpdateStages.WithHostingMode, UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithNetworkRuleSet, UpdateStages.WithDisabledDataExfiltrationOptions, + UpdateStages.WithEncryptionWithCmk, UpdateStages.WithDisableLocalAuth, UpdateStages.WithAuthOptions, + UpdateStages.WithSemanticSearch, UpdateStages.WithClientRequestId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SearchService apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SearchService apply(Context context); + } + + /** + * The SearchService update stages. + */ + interface UpdateStages { + /** + * The stage of the SearchService update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Tags to help categorize the resource in the Azure portal.. + * + * @param tags Tags to help categorize the resource in the Azure portal. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SearchService update allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: The SKU of the search service, which determines price tier and capacity + * limits. This property is required when creating a new search service.. + * + * @param sku The SKU of the search service, which determines price tier and capacity limits. This property + * is required when creating a new search service. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the SearchService update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Details about the search service identity. A null value indicates that + * the search service has no identity assigned.. + * + * @param identity Details about the search service identity. A null value indicates that the search service + * has no identity assigned. + * @return the next definition stage. + */ + Update withIdentity(Identity identity); + } + + /** + * The stage of the SearchService update allowing to specify replicaCount. + */ + interface WithReplicaCount { + /** + * Specifies the replicaCount property: The number of replicas in the search service. If specified, it must + * be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU.. + * + * @param replicaCount The number of replicas in the search service. If specified, it must be a value + * between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * @return the next definition stage. + */ + Update withReplicaCount(Integer replicaCount); + } + + /** + * The stage of the SearchService update allowing to specify partitionCount. + */ + interface WithPartitionCount { + /** + * Specifies the partitionCount property: The number of partitions in the search service; if specified, it + * can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' + * services with hostingMode set to 'highDensity', the allowed values are between 1 and 3.. + * + * @param partitionCount The number of partitions in the search service; if specified, it can be 1, 2, 3, 4, + * 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with + * hostingMode set to 'highDensity', the allowed values are between 1 and 3. + * @return the next definition stage. + */ + Update withPartitionCount(Integer partitionCount); + } + + /** + * The stage of the SearchService update allowing to specify hostingMode. + */ + interface WithHostingMode { + /** + * Specifies the hostingMode property: Applicable only for the standard3 SKU. You can set this property to + * enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the + * maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or + * 'highDensity'. For all other SKUs, this value must be 'default'.. + * + * @param hostingMode Applicable only for the standard3 SKU. You can set this property to enable up to 3 + * high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes + * allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all + * other SKUs, this value must be 'default'. + * @return the next definition stage. + */ + Update withHostingMode(HostingMode hostingMode); + } + + /** + * The stage of the SearchService update allowing to specify publicNetworkAccess. + */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: This value can be set to 'enabled' to avoid breaking changes + * on existing customer resources and templates. If set to 'disabled', traffic over public interface is not + * allowed, and private endpoint connections would be the exclusive access method.. + * + * @param publicNetworkAccess This value can be set to 'enabled' to avoid breaking changes on existing + * customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and + * private endpoint connections would be the exclusive access method. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + + /** + * The stage of the SearchService update allowing to specify networkRuleSet. + */ + interface WithNetworkRuleSet { + /** + * Specifies the networkRuleSet property: Network specific rules that determine how the Azure AI Search + * service may be reached.. + * + * @param networkRuleSet Network specific rules that determine how the Azure AI Search service may be + * reached. + * @return the next definition stage. + */ + Update withNetworkRuleSet(NetworkRuleSet networkRuleSet); + } + + /** + * The stage of the SearchService update allowing to specify disabledDataExfiltrationOptions. + */ + interface WithDisabledDataExfiltrationOptions { + /** + * Specifies the disabledDataExfiltrationOptions property: A list of data exfiltration scenarios that are + * explicitly disallowed for the search service. Currently, the only supported value is 'All' to disable all + * possible data export scenarios with more fine grained controls planned for the future.. + * + * @param disabledDataExfiltrationOptions A list of data exfiltration scenarios that are explicitly + * disallowed for the search service. Currently, the only supported value is 'All' to disable all possible + * data export scenarios with more fine grained controls planned for the future. + * @return the next definition stage. + */ + Update withDisabledDataExfiltrationOptions( + List disabledDataExfiltrationOptions); + } + + /** + * The stage of the SearchService update allowing to specify encryptionWithCmk. + */ + interface WithEncryptionWithCmk { + /** + * Specifies the encryptionWithCmk property: Specifies any policy regarding encryption of resources (such as + * indexes) using customer manager keys within a search service.. + * + * @param encryptionWithCmk Specifies any policy regarding encryption of resources (such as indexes) using + * customer manager keys within a search service. + * @return the next definition stage. + */ + Update withEncryptionWithCmk(EncryptionWithCmk encryptionWithCmk); + } + + /** + * The stage of the SearchService update allowing to specify disableLocalAuth. + */ + interface WithDisableLocalAuth { + /** + * Specifies the disableLocalAuth property: 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.. + * + * @param disableLocalAuth 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. + * @return the next definition stage. + */ + Update withDisableLocalAuth(Boolean disableLocalAuth); + } + + /** + * The stage of the SearchService update allowing to specify authOptions. + */ + interface WithAuthOptions { + /** + * Specifies the authOptions property: 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.. + * + * @param authOptions 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. + * @return the next definition stage. + */ + Update withAuthOptions(DataPlaneAuthOptions authOptions); + } + + /** + * The stage of the SearchService update allowing to specify semanticSearch. + */ + interface WithSemanticSearch { + /** + * Specifies the semanticSearch property: Sets options that control the availability of semantic search. + * This configuration is only possible for certain Azure AI Search SKUs in certain locations.. + * + * @param semanticSearch Sets options that control the availability of semantic search. This configuration + * is only possible for certain Azure AI Search SKUs in certain locations. + * @return the next definition stage. + */ + Update withSemanticSearch(SearchSemanticSearch semanticSearch); + } + + /** + * The stage of the SearchService update allowing to specify clientRequestId. + */ + interface WithClientRequestId { + /** + * Specifies the clientRequestId property: A client-generated GUID value that identifies this request. If + * specified, this will be included in response information as a way to track the request.. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this + * will be included in response information as a way to track the request. + * @return the next definition stage. + */ + Update withClientRequestId(UUID clientRequestId); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SearchService refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SearchService refresh(Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceListResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceListResult.java new file mode 100644 index 0000000000000..dc1ff07751c8e --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceListResult.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.search.fluent.models.SearchServiceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Response containing a list of Azure AI Search services. + */ +@Immutable +public final class SearchServiceListResult { + /* + * The list of search services. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Request URL that can be used to query next page of search services. Returned when the total number of requested search services exceed maximum page size. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of SearchServiceListResult class. + */ + public SearchServiceListResult() { + } + + /** + * Get the value property: The list of search services. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Request URL that can be used to query next page of search services. Returned when the + * total number of requested search services exceed maximum page size. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceStatus.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceStatus.java new file mode 100644 index 0000000000000..5eb2aa27bcb1f --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceStatus.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * The status of the search service. Possible values include: 'running': The search service is running and no + * provisioning operations are underway. 'provisioning': The search service is being provisioned or scaled up or down. + * 'deleting': The search service is being deleted. 'degraded': The search service is degraded. This can occur when the + * underlying search units are not healthy. The search service is most likely operational, but performance might be slow + * and some requests might be dropped. 'disabled': The search service is disabled. In this state, the service will + * reject all API requests. 'error': The search service is in an error state. 'stopped': The search service is in a + * subscription that's disabled. If your service is in the degraded, disabled, or error states, it means the Azure AI + * Search team is actively investigating the underlying issue. Dedicated services in these states are still chargeable + * based on the number of search units provisioned. + */ +public enum SearchServiceStatus { + /** + * Enum value running. + */ + RUNNING("running"), + + /** + * Enum value provisioning. + */ + PROVISIONING("provisioning"), + + /** + * Enum value deleting. + */ + DELETING("deleting"), + + /** + * Enum value degraded. + */ + DEGRADED("degraded"), + + /** + * Enum value disabled. + */ + DISABLED("disabled"), + + /** + * Enum value error. + */ + ERROR("error"), + + /** + * Enum value stopped. + */ + STOPPED("stopped"); + + /** + * The actual serialized value for a SearchServiceStatus instance. + */ + private final String value; + + SearchServiceStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SearchServiceStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed SearchServiceStatus object, or null if unable to parse. + */ + @JsonCreator + public static SearchServiceStatus fromString(String value) { + if (value == null) { + return null; + } + SearchServiceStatus[] items = SearchServiceStatus.values(); + for (SearchServiceStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceUpdate.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceUpdate.java new file mode 100644 index 0000000000000..2fdb6cf09723c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceUpdate.java @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.search.fluent.models.SearchServiceProperties; +import com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * The parameters used to update an Azure AI Search service. + */ +@Fluent +public final class SearchServiceUpdate extends ProxyResource { + /* + * Properties of the search service. + */ + @JsonProperty(value = "properties") + private SearchServiceProperties innerProperties; + + /* + * The SKU of the search service, which determines price tier and capacity limits. This property is required when creating a new search service. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * The geographic location of the resource. This must be one of the supported and registered Azure geo regions (for example, West US, East US, Southeast Asia, and so forth). This property is required when creating a new resource. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Tags to help categorize the resource in the Azure portal. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Details about the search service identity. A null value indicates that the search service has no identity assigned. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Creates an instance of SearchServiceUpdate class. + */ + public SearchServiceUpdate() { + } + + /** + * Get the innerProperties property: Properties of the search service. + * + * @return the innerProperties value. + */ + private SearchServiceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: The SKU of the search service, which determines price tier and capacity limits. This + * property is required when creating a new search service. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the search service, which determines price tier and capacity limits. This + * property is required when creating a new search service. + * + * @param sku the sku value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the location property: The geographic location of the resource. This must be one of the supported and + * registered Azure geo regions (for example, West US, East US, Southeast Asia, and so forth). This property is + * required when creating a new resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geographic location of the resource. This must be one of the supported and + * registered Azure geo regions (for example, West US, East US, Southeast Asia, and so forth). This property is + * required when creating a new resource. + * + * @param location the location value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Tags to help categorize the resource in the Azure portal. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags to help categorize the resource in the Azure portal. + * + * @param tags the tags value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: Details about the search service identity. A null value indicates that the search + * service has no identity assigned. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Details about the search service identity. A null value indicates that the search + * service has no identity assigned. + * + * @param identity the identity value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the replicaCount property: The number of replicas in the search service. If specified, it must be a value + * between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * + * @return the replicaCount value. + */ + public Integer replicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().replicaCount(); + } + + /** + * Set the replicaCount property: The number of replicas in the search service. If specified, it must be a value + * between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * + * @param replicaCount the replicaCount value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withReplicaCount(Integer replicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withReplicaCount(replicaCount); + return this; + } + + /** + * Get the partitionCount property: The number of partitions in the search service; if specified, it can be 1, 2, 3, + * 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode + * set to 'highDensity', the allowed values are between 1 and 3. + * + * @return the partitionCount value. + */ + public Integer partitionCount() { + return this.innerProperties() == null ? null : this.innerProperties().partitionCount(); + } + + /** + * Set the partitionCount property: The number of partitions in the search service; if specified, it can be 1, 2, 3, + * 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode + * set to 'highDensity', the allowed values are between 1 and 3. + * + * @param partitionCount the partitionCount value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withPartitionCount(Integer partitionCount) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withPartitionCount(partitionCount); + return this; + } + + /** + * Get the hostingMode property: Applicable only for the standard3 SKU. You can set this property to enable up to 3 + * high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for + * any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this + * value must be 'default'. + * + * @return the hostingMode value. + */ + public HostingMode hostingMode() { + return this.innerProperties() == null ? null : this.innerProperties().hostingMode(); + } + + /** + * Set the hostingMode property: Applicable only for the standard3 SKU. You can set this property to enable up to 3 + * high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for + * any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this + * value must be 'default'. + * + * @param hostingMode the hostingMode value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withHostingMode(HostingMode hostingMode) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withHostingMode(hostingMode); + return this; + } + + /** + * Get the publicNetworkAccess property: This value can be set to 'enabled' to avoid breaking changes on existing + * customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private + * endpoint connections would be the exclusive access method. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: This value can be set to 'enabled' to avoid breaking changes on existing + * customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private + * endpoint connections would be the exclusive access method. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the status property: The status of the search service. Possible values include: 'running': The search service + * is running and no provisioning operations are underway. 'provisioning': The search service is being provisioned + * or scaled up or down. 'deleting': The search service is being deleted. 'degraded': The search service is + * degraded. This can occur when the underlying search units are not healthy. The search service is most likely + * operational, but performance might be slow and some requests might be dropped. 'disabled': The search service is + * disabled. In this state, the service will reject all API requests. 'error': The search service is in an error + * state. 'stopped': The search service is in a subscription that's disabled. If your service is in the degraded, + * disabled, or error states, it means the Azure AI Search team is actively investigating the underlying issue. + * Dedicated services in these states are still chargeable based on the number of search units provisioned. + * + * @return the status value. + */ + public SearchServiceStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the statusDetails property: The details of the search service status. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.innerProperties() == null ? null : this.innerProperties().statusDetails(); + } + + /** + * Get the provisioningState property: The state of the last provisioning operation performed on the search service. + * Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is + * set up, provisioningState changes to either 'Succeeded' or 'Failed'. Client applications can poll provisioning + * status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service + * operation to see when an operation is completed. If you are using the free service, this value tends to come back + * as 'Succeeded' directly in the call to Create search service. This is because the free service uses capacity that + * is already set up. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the networkRuleSet property: Network specific rules that determine how the Azure AI Search service may be + * reached. + * + * @return the networkRuleSet value. + */ + public NetworkRuleSet networkRuleSet() { + return this.innerProperties() == null ? null : this.innerProperties().networkRuleSet(); + } + + /** + * Set the networkRuleSet property: Network specific rules that determine how the Azure AI Search service may be + * reached. + * + * @param networkRuleSet the networkRuleSet value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withNetworkRuleSet(NetworkRuleSet networkRuleSet) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withNetworkRuleSet(networkRuleSet); + return this; + } + + /** + * Get the disabledDataExfiltrationOptions property: A list of data exfiltration scenarios that are explicitly + * disallowed for the search service. Currently, the only supported value is 'All' to disable all possible data + * export scenarios with more fine grained controls planned for the future. + * + * @return the disabledDataExfiltrationOptions value. + */ + public List disabledDataExfiltrationOptions() { + return this.innerProperties() == null ? null : this.innerProperties().disabledDataExfiltrationOptions(); + } + + /** + * Set the disabledDataExfiltrationOptions property: A list of data exfiltration scenarios that are explicitly + * disallowed for the search service. Currently, the only supported value is 'All' to disable all possible data + * export scenarios with more fine grained controls planned for the future. + * + * @param disabledDataExfiltrationOptions the disabledDataExfiltrationOptions value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withDisabledDataExfiltrationOptions( + List disabledDataExfiltrationOptions) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withDisabledDataExfiltrationOptions(disabledDataExfiltrationOptions); + return this; + } + + /** + * Get the encryptionWithCmk property: Specifies any policy regarding encryption of resources (such as indexes) + * using customer manager keys within a search service. + * + * @return the encryptionWithCmk value. + */ + public EncryptionWithCmk encryptionWithCmk() { + return this.innerProperties() == null ? null : this.innerProperties().encryptionWithCmk(); + } + + /** + * Set the encryptionWithCmk property: Specifies any policy regarding encryption of resources (such as indexes) + * using customer manager keys within a search service. + * + * @param encryptionWithCmk the encryptionWithCmk value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withEncryptionWithCmk(EncryptionWithCmk encryptionWithCmk) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withEncryptionWithCmk(encryptionWithCmk); + return this; + } + + /** + * Get the disableLocalAuth property: 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. + * + * @return the disableLocalAuth value. + */ + public Boolean disableLocalAuth() { + return this.innerProperties() == null ? null : this.innerProperties().disableLocalAuth(); + } + + /** + * Set the disableLocalAuth property: 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. + * + * @param disableLocalAuth the disableLocalAuth value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withDisableLocalAuth(Boolean disableLocalAuth) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withDisableLocalAuth(disableLocalAuth); + return this; + } + + /** + * Get the authOptions property: 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. + * + * @return the authOptions value. + */ + public DataPlaneAuthOptions authOptions() { + return this.innerProperties() == null ? null : this.innerProperties().authOptions(); + } + + /** + * Set the authOptions property: 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. + * + * @param authOptions the authOptions value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withAuthOptions(DataPlaneAuthOptions authOptions) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withAuthOptions(authOptions); + return this; + } + + /** + * Get the semanticSearch property: Sets options that control the availability of semantic search. This + * configuration is only possible for certain Azure AI Search SKUs in certain locations. + * + * @return the semanticSearch value. + */ + public SearchSemanticSearch semanticSearch() { + return this.innerProperties() == null ? null : this.innerProperties().semanticSearch(); + } + + /** + * Set the semanticSearch property: Sets options that control the availability of semantic search. This + * configuration is only possible for certain Azure AI Search SKUs in certain locations. + * + * @param semanticSearch the semanticSearch value to set. + * @return the SearchServiceUpdate object itself. + */ + public SearchServiceUpdate withSemanticSearch(SearchSemanticSearch semanticSearch) { + if (this.innerProperties() == null) { + this.innerProperties = new SearchServiceProperties(); + } + this.innerProperties().withSemanticSearch(semanticSearch); + return this; + } + + /** + * Get the privateEndpointConnections property: The list of private endpoint connections to the Azure AI Search + * service. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the sharedPrivateLinkResources property: The list of shared private link resources managed by the Azure AI + * Search service. + * + * @return the sharedPrivateLinkResources value. + */ + public List sharedPrivateLinkResources() { + return this.innerProperties() == null ? null : this.innerProperties().sharedPrivateLinkResources(); + } + + /** + * Get the etag property: A system generated property representing the service's etag that can be for optimistic + * concurrency control during updates. + * + * @return the etag value. + */ + public String etag() { + return this.innerProperties() == null ? null : this.innerProperties().etag(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Services.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Services.java new file mode 100644 index 0000000000000..7abf0cb0181bf --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Services.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of Services. + */ +public interface Services { + /** + * Gets the search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); + + /** + * Gets the search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group. + */ + SearchService getByResourceGroup(String resourceGroupName, String searchServiceName); + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String searchServiceName, UUID clientRequestId, + Context context); + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String searchServiceName); + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given resource group as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, UUID clientRequestId, Context context); + + /** + * Gets a list of all Search services in the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all Search services in the given subscription. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Search services in the given subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(UUID clientRequestId, Context context); + + /** + * Checks whether or not the given search service name is available for use. Search service names must be globally + * unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param checkNameAvailabilityInput The resource name and type to check. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of check name availability API along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityInput checkNameAvailabilityInput, UUID clientRequestId, Context context); + + /** + * Checks whether or not the given search service name is available for use. Search service names must be globally + * unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param checkNameAvailabilityInput The resource name and type to check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output of check name availability API. + */ + CheckNameAvailabilityOutput checkNameAvailability(CheckNameAvailabilityInput checkNameAvailabilityInput); + + /** + * Gets the search service with the given name in the given resource group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group along with {@link Response}. + */ + SearchService getById(String id); + + /** + * Gets the search service with the given name in the given resource group. + * + * @param id the resource ID. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the search service with the given name in the given resource group along with {@link Response}. + */ + Response getByIdWithResponse(String id, UUID clientRequestId, Context context); + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a search service in the given resource group, along with its associated resources. + * + * @param id the resource ID. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, UUID clientRequestId, Context context); + + /** + * Begins definition for a new SearchService resource. + * + * @param name resource name. + * @return the first stage of the new SearchService definition. + */ + SearchService.DefinitionStages.Blank define(String name); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceProperties.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..00dbe059b5bc7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceProperties.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the properties of a resource type that has been onboarded to private link service, supported by Azure AI + * Search. + */ +@Immutable +public final class ShareablePrivateLinkResourceProperties { + /* + * The resource provider type for the resource that has been onboarded to private link service, supported by Azure AI Search. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The resource provider group id for the resource that has been onboarded to private link service, supported by Azure AI Search. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The description of the resource type that has been onboarded to private link service, supported by Azure AI Search. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Creates an instance of ShareablePrivateLinkResourceProperties class. + */ + public ShareablePrivateLinkResourceProperties() { + } + + /** + * Get the type property: The resource provider type for the resource that has been onboarded to private link + * service, supported by Azure AI Search. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the groupId property: The resource provider group id for the resource that has been onboarded to private link + * service, supported by Azure AI Search. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the description property: The description of the resource type that has been onboarded to private link + * service, supported by Azure AI Search. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceType.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceType.java new file mode 100644 index 0000000000000..701de576a3eb0 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceType.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes an resource type that has been onboarded to private link service, supported by Azure AI Search. + */ +@Immutable +public final class ShareablePrivateLinkResourceType { + /* + * The name of the resource type that has been onboarded to private link service, supported by Azure AI Search. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Describes the properties of a resource type that has been onboarded to private link service, supported by Azure AI Search. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private ShareablePrivateLinkResourceProperties properties; + + /** + * Creates an instance of ShareablePrivateLinkResourceType class. + */ + public ShareablePrivateLinkResourceType() { + } + + /** + * Get the name property: The name of the resource type that has been onboarded to private link service, supported + * by Azure AI Search. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the properties property: Describes the properties of a resource type that has been onboarded to private link + * service, supported by Azure AI Search. + * + * @return the properties value. + */ + public ShareablePrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResource.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResource.java new file mode 100644 index 0000000000000..f39001bfe938d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResource.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner; +import java.util.UUID; + +/** + * An immutable client-side representation of SharedPrivateLinkResource. + */ +public interface SharedPrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Describes the properties of a shared private link resource managed by the Azure AI + * Search service. + * + * @return the properties value. + */ + SharedPrivateLinkResourceProperties properties(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner object. + * + * @return the inner object. + */ + SharedPrivateLinkResourceInner innerModel(); + + /** + * The entirety of the SharedPrivateLinkResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The SharedPrivateLinkResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SharedPrivateLinkResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SharedPrivateLinkResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, searchServiceName. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource + * group. + * @return the next definition stage. + */ + WithCreate withExistingSearchService(String resourceGroupName, String searchServiceName); + } + + /** + * The stage of the SharedPrivateLinkResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties, DefinitionStages.WithClientRequestId { + /** + * Executes the create request. + * + * @return the created resource. + */ + SharedPrivateLinkResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SharedPrivateLinkResource create(Context context); + } + + /** + * The stage of the SharedPrivateLinkResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Describes the properties of a shared private link resource managed by + * the Azure AI Search service.. + * + * @param properties Describes the properties of a shared private link resource managed by the Azure AI + * Search service. + * @return the next definition stage. + */ + WithCreate withProperties(SharedPrivateLinkResourceProperties properties); + } + + /** + * The stage of the SharedPrivateLinkResource definition allowing to specify clientRequestId. + */ + interface WithClientRequestId { + /** + * Specifies the clientRequestId property: A client-generated GUID value that identifies this request. If + * specified, this will be included in response information as a way to track the request.. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this + * will be included in response information as a way to track the request. + * @return the next definition stage. + */ + WithCreate withClientRequestId(UUID clientRequestId); + } + } + + /** + * Begins update for the SharedPrivateLinkResource resource. + * + * @return the stage of resource update. + */ + SharedPrivateLinkResource.Update update(); + + /** + * The template for SharedPrivateLinkResource update. + */ + interface Update extends UpdateStages.WithProperties, UpdateStages.WithClientRequestId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SharedPrivateLinkResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SharedPrivateLinkResource apply(Context context); + } + + /** + * The SharedPrivateLinkResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SharedPrivateLinkResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Describes the properties of a shared private link resource managed by + * the Azure AI Search service.. + * + * @param properties Describes the properties of a shared private link resource managed by the Azure AI + * Search service. + * @return the next definition stage. + */ + Update withProperties(SharedPrivateLinkResourceProperties properties); + } + + /** + * The stage of the SharedPrivateLinkResource update allowing to specify clientRequestId. + */ + interface WithClientRequestId { + /** + * Specifies the clientRequestId property: A client-generated GUID value that identifies this request. If + * specified, this will be included in response information as a way to track the request.. + * + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this + * will be included in response information as a way to track the request. + * @return the next definition stage. + */ + Update withClientRequestId(UUID clientRequestId); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SharedPrivateLinkResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SharedPrivateLinkResource refresh(Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceListResult.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..cc1662165f3fc --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceListResult.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Response containing a list of shared private link resources. + */ +@Fluent +public final class SharedPrivateLinkResourceListResult { + /* + * The list of shared private link resources. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URL to get the next set of shared private link resources, if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Creates an instance of SharedPrivateLinkResourceListResult class. + */ + public SharedPrivateLinkResourceListResult() { + } + + /** + * Get the value property: The list of shared private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URL to get the next set of shared private link resources, if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of shared private link resources, if there are any. + * + * @param nextLink the nextLink value to set. + * @return the SharedPrivateLinkResourceListResult object itself. + */ + public SharedPrivateLinkResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProperties.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..32d3dbd392aaf --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProperties.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the properties of an existing shared private link resource managed by the Azure AI Search service. + */ +@Fluent +public final class SharedPrivateLinkResourceProperties { + /* + * The resource ID of the resource the shared private link resource is for. + */ + @JsonProperty(value = "privateLinkResourceId") + private String privateLinkResourceId; + + /* + * The group ID from the provider of resource the shared private link resource is for. + */ + @JsonProperty(value = "groupId") + private String groupId; + + /* + * The message for requesting approval of the shared private link resource. + */ + @JsonProperty(value = "requestMessage") + private String requestMessage; + + /* + * Optional. Can be used to specify the Azure Resource Manager location of the resource for which a shared private link is being created. This is only required for those resources whose DNS configuration are regional (such as Azure Kubernetes Service). + */ + @JsonProperty(value = "resourceRegion") + private String resourceRegion; + + /* + * Status of the shared private link resource. Valid values are Pending, Approved, Rejected or Disconnected. + */ + @JsonProperty(value = "status") + private SharedPrivateLinkResourceStatus status; + + /* + * The provisioning state of the shared private link resource. Valid values are Updating, Deleting, Failed, Succeeded or Incomplete. + */ + @JsonProperty(value = "provisioningState") + private SharedPrivateLinkResourceProvisioningState provisioningState; + + /** + * Creates an instance of SharedPrivateLinkResourceProperties class. + */ + public SharedPrivateLinkResourceProperties() { + } + + /** + * Get the privateLinkResourceId property: The resource ID of the resource the shared private link resource is for. + * + * @return the privateLinkResourceId value. + */ + public String privateLinkResourceId() { + return this.privateLinkResourceId; + } + + /** + * Set the privateLinkResourceId property: The resource ID of the resource the shared private link resource is for. + * + * @param privateLinkResourceId the privateLinkResourceId value to set. + * @return the SharedPrivateLinkResourceProperties object itself. + */ + public SharedPrivateLinkResourceProperties withPrivateLinkResourceId(String privateLinkResourceId) { + this.privateLinkResourceId = privateLinkResourceId; + return this; + } + + /** + * Get the groupId property: The group ID from the provider of resource the shared private link resource is for. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Set the groupId property: The group ID from the provider of resource the shared private link resource is for. + * + * @param groupId the groupId value to set. + * @return the SharedPrivateLinkResourceProperties object itself. + */ + public SharedPrivateLinkResourceProperties withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the requestMessage property: The message for requesting approval of the shared private link resource. + * + * @return the requestMessage value. + */ + public String requestMessage() { + return this.requestMessage; + } + + /** + * Set the requestMessage property: The message for requesting approval of the shared private link resource. + * + * @param requestMessage the requestMessage value to set. + * @return the SharedPrivateLinkResourceProperties object itself. + */ + public SharedPrivateLinkResourceProperties withRequestMessage(String requestMessage) { + this.requestMessage = requestMessage; + return this; + } + + /** + * Get the resourceRegion property: Optional. Can be used to specify the Azure Resource Manager location of the + * resource for which a shared private link is being created. This is only required for those resources whose DNS + * configuration are regional (such as Azure Kubernetes Service). + * + * @return the resourceRegion value. + */ + public String resourceRegion() { + return this.resourceRegion; + } + + /** + * Set the resourceRegion property: Optional. Can be used to specify the Azure Resource Manager location of the + * resource for which a shared private link is being created. This is only required for those resources whose DNS + * configuration are regional (such as Azure Kubernetes Service). + * + * @param resourceRegion the resourceRegion value to set. + * @return the SharedPrivateLinkResourceProperties object itself. + */ + public SharedPrivateLinkResourceProperties withResourceRegion(String resourceRegion) { + this.resourceRegion = resourceRegion; + return this; + } + + /** + * Get the status property: Status of the shared private link resource. Valid values are Pending, Approved, Rejected + * or Disconnected. + * + * @return the status value. + */ + public SharedPrivateLinkResourceStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the shared private link resource. Valid values are Pending, Approved, Rejected + * or Disconnected. + * + * @param status the status value to set. + * @return the SharedPrivateLinkResourceProperties object itself. + */ + public SharedPrivateLinkResourceProperties withStatus(SharedPrivateLinkResourceStatus status) { + this.status = status; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the shared private link resource. Valid values are + * Updating, Deleting, Failed, Succeeded or Incomplete. + * + * @return the provisioningState value. + */ + public SharedPrivateLinkResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The provisioning state of the shared private link resource. Valid values are + * Updating, Deleting, Failed, Succeeded or Incomplete. + * + * @param provisioningState the provisioningState value to set. + * @return the SharedPrivateLinkResourceProperties object itself. + */ + public SharedPrivateLinkResourceProperties + withProvisioningState(SharedPrivateLinkResourceProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProvisioningState.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProvisioningState.java new file mode 100644 index 0000000000000..90f4e9bb1653c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProvisioningState.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The provisioning state of the shared private link resource. Valid values are Updating, Deleting, Failed, Succeeded or + * Incomplete. + */ +public final class SharedPrivateLinkResourceProvisioningState + extends ExpandableStringEnum { + /** + * Static value Updating for SharedPrivateLinkResourceProvisioningState. + */ + public static final SharedPrivateLinkResourceProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for SharedPrivateLinkResourceProvisioningState. + */ + public static final SharedPrivateLinkResourceProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Failed for SharedPrivateLinkResourceProvisioningState. + */ + public static final SharedPrivateLinkResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Succeeded for SharedPrivateLinkResourceProvisioningState. + */ + public static final SharedPrivateLinkResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Incomplete for SharedPrivateLinkResourceProvisioningState. + */ + public static final SharedPrivateLinkResourceProvisioningState INCOMPLETE = fromString("Incomplete"); + + /** + * Creates a new instance of SharedPrivateLinkResourceProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SharedPrivateLinkResourceProvisioningState() { + } + + /** + * Creates or finds a SharedPrivateLinkResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SharedPrivateLinkResourceProvisioningState. + */ + @JsonCreator + public static SharedPrivateLinkResourceProvisioningState fromString(String name) { + return fromString(name, SharedPrivateLinkResourceProvisioningState.class); + } + + /** + * Gets known SharedPrivateLinkResourceProvisioningState values. + * + * @return known SharedPrivateLinkResourceProvisioningState values. + */ + public static Collection values() { + return values(SharedPrivateLinkResourceProvisioningState.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceStatus.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceStatus.java new file mode 100644 index 0000000000000..ab397b0e7823a --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceStatus.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Status of the shared private link resource. Valid values are Pending, Approved, Rejected or Disconnected. + */ +public final class SharedPrivateLinkResourceStatus extends ExpandableStringEnum { + /** + * Static value Pending for SharedPrivateLinkResourceStatus. + */ + public static final SharedPrivateLinkResourceStatus PENDING = fromString("Pending"); + + /** + * Static value Approved for SharedPrivateLinkResourceStatus. + */ + public static final SharedPrivateLinkResourceStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for SharedPrivateLinkResourceStatus. + */ + public static final SharedPrivateLinkResourceStatus REJECTED = fromString("Rejected"); + + /** + * Static value Disconnected for SharedPrivateLinkResourceStatus. + */ + public static final SharedPrivateLinkResourceStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates a new instance of SharedPrivateLinkResourceStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SharedPrivateLinkResourceStatus() { + } + + /** + * Creates or finds a SharedPrivateLinkResourceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SharedPrivateLinkResourceStatus. + */ + @JsonCreator + public static SharedPrivateLinkResourceStatus fromString(String name) { + return fromString(name, SharedPrivateLinkResourceStatus.class); + } + + /** + * Gets known SharedPrivateLinkResourceStatus values. + * + * @return known SharedPrivateLinkResourceStatus values. + */ + public static Collection values() { + return values(SharedPrivateLinkResourceStatus.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResources.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResources.java new file mode 100644 index 0000000000000..80eab5107e763 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResources.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of SharedPrivateLinkResources. + */ +public interface SharedPrivateLinkResources { + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource group + * along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName, UUID clientRequestId, Context context); + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource + * group. + */ + SharedPrivateLinkResource get(String resourceGroupName, String searchServiceName, + String sharedPrivateLinkResourceName); + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName); + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure AI Search + * service within the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String searchServiceName, String sharedPrivateLinkResourceName, + UUID clientRequestId, Context context); + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByService(String resourceGroupName, String searchServiceName); + + /** + * Gets a list of all shared private link resources managed by the given service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure AI Search service associated with the specified resource group. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all shared private link resources managed by the given service as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByService(String resourceGroupName, String searchServiceName, + UUID clientRequestId, Context context); + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource group + * along with {@link Response}. + */ + SharedPrivateLinkResource getById(String id); + + /** + * Gets the details of the shared private link resource managed by the search service in the given resource group. + * + * @param id the resource ID. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the shared private link resource managed by the search service in the given resource group + * along with {@link Response}. + */ + Response getByIdWithResponse(String id, UUID clientRequestId, Context context); + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Initiates the deletion of the shared private link resource from the search service. + * + * @param id the resource ID. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, UUID clientRequestId, Context context); + + /** + * Begins definition for a new SharedPrivateLinkResource resource. + * + * @param name resource name. + * @return the first stage of the new SharedPrivateLinkResource definition. + */ + SharedPrivateLinkResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Sku.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Sku.java new file mode 100644 index 0000000000000..c72528443001c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Sku.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines the SKU of a search service, which determines billing rate and capacity limits. + */ +@Fluent +public final class Sku { + /* + * The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 partitions with more indexes if you also set the hostingMode property to 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.' + */ + @JsonProperty(value = "name") + private SkuName name; + + /** + * Creates an instance of Sku class. + */ + public Sku() { + } + + /** + * Get the name property: The SKU of the search service. Valid values include: 'free': Shared service. 'basic': + * Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. + * 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard + * offering with up to 12 partitions and 12 replicas (or up to 3 partitions with more indexes if you also set the + * hostingMode property to 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. + * 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'. + * + * @return the name value. + */ + public SkuName name() { + return this.name; + } + + /** + * Set the name property: The SKU of the search service. Valid values include: 'free': Shared service. 'basic': + * Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. + * 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard + * offering with up to 12 partitions and 12 replicas (or up to 3 partitions with more indexes if you also set the + * hostingMode property to 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. + * 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(SkuName name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SkuName.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SkuName.java new file mode 100644 index 0000000000000..bb87bb1ff047f --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SkuName.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 + * replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, + * but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 + * replicas (or up to 3 partitions with more indexes if you also set the hostingMode property to 'highDensity'). + * 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. 'storage_optimized_l2': Supports 2TB per + * partition, up to 12 partitions.'. + */ +public final class SkuName extends ExpandableStringEnum { + /** + * Static value free for SkuName. + */ + public static final SkuName FREE = fromString("free"); + + /** + * Static value basic for SkuName. + */ + public static final SkuName BASIC = fromString("basic"); + + /** + * Static value standard for SkuName. + */ + public static final SkuName STANDARD = fromString("standard"); + + /** + * Static value standard2 for SkuName. + */ + public static final SkuName STANDARD2 = fromString("standard2"); + + /** + * Static value standard3 for SkuName. + */ + public static final SkuName STANDARD3 = fromString("standard3"); + + /** + * Static value storage_optimized_l1 for SkuName. + */ + public static final SkuName STORAGE_OPTIMIZED_L1 = fromString("storage_optimized_l1"); + + /** + * Static value storage_optimized_l2 for SkuName. + */ + public static final SkuName STORAGE_OPTIMIZED_L2 = fromString("storage_optimized_l2"); + + /** + * Creates a new instance of SkuName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SkuName() { + } + + /** + * Creates or finds a SkuName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuName. + */ + @JsonCreator + public static SkuName fromString(String name) { + return fromString(name, SkuName.class); + } + + /** + * Gets known SkuName values. + * + * @return known SkuName values. + */ + public static Collection values() { + return values(SkuName.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/UnavailableNameReason.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/UnavailableNameReason.java new file mode 100644 index 0000000000000..3e6513261554b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/UnavailableNameReason.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The reason why the name is not available. 'Invalid' indicates the name provided does not match the naming + * requirements (incorrect length, unsupported characters, etc.). 'AlreadyExists' indicates that the name is already in + * use and is therefore unavailable. + */ +public final class UnavailableNameReason extends ExpandableStringEnum { + /** + * Static value Invalid for UnavailableNameReason. + */ + public static final UnavailableNameReason INVALID = fromString("Invalid"); + + /** + * Static value AlreadyExists for UnavailableNameReason. + */ + public static final UnavailableNameReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of UnavailableNameReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public UnavailableNameReason() { + } + + /** + * Creates or finds a UnavailableNameReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding UnavailableNameReason. + */ + @JsonCreator + public static UnavailableNameReason fromString(String name) { + return fromString(name, UnavailableNameReason.class); + } + + /** + * Gets known UnavailableNameReason values. + * + * @return known UnavailableNameReason values. + */ + public static Collection values() { + return values(UnavailableNameReason.class); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Usages.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Usages.java new file mode 100644 index 0000000000000..eeac6fccc3321 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Usages.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import java.util.UUID; + +/** + * Resource collection API of Usages. + */ +public interface Usages { + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listBySubscription(String location); + + /** + * Get a list of all Azure AI Search quota usages across the subscription. + * + * @param location The unique location name for a Microsoft Azure geographic region. + * @param clientRequestId A client-generated GUID value that identifies this request. If specified, this will be + * included in response information as a way to track the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure AI Search quota usages across the subscription as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listBySubscription(String location, UUID clientRequestId, Context context); +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/UserAssignedManagedIdentity.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/UserAssignedManagedIdentity.java new file mode 100644 index 0000000000000..e0f571d675706 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/UserAssignedManagedIdentity.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the user assigned managed identity assigned to the search service. + */ +@Immutable +public final class UserAssignedManagedIdentity { + /* + * The principal ID of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client ID of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Creates an instance of UserAssignedManagedIdentity class. + */ + public UserAssignedManagedIdentity() { + } + + /** + * Get the principalId property: The principal ID of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/package-info.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/package-info.java new file mode 100644 index 0000000000000..6f4c7fdee20e8 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for SearchManagementClient. + * Client that can be used to manage Azure AI Search services and API keys. + */ +package com.azure.resourcemanager.search.models; diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/package-info.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/package-info.java new file mode 100644 index 0000000000000..ade5f8b477343 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for SearchManagementClient. + * Client that can be used to manage Azure AI Search services and API keys. + */ +package com.azure.resourcemanager.search; diff --git a/sdk/search/azure-resourcemanager-search/src/main/java/module-info.java b/sdk/search/azure-resourcemanager-search/src/main/java/module-info.java new file mode 100644 index 0000000000000..b7c8d4261e97b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.search { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.search; + exports com.azure.resourcemanager.search.fluent; + exports com.azure.resourcemanager.search.fluent.models; + exports com.azure.resourcemanager.search.models; + opens com.azure.resourcemanager.search.fluent.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.search.models to com.azure.core, com.fasterxml.jackson.databind; +} \ No newline at end of file diff --git a/sdk/search/azure-resourcemanager-search/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-search/proxy-config.json b/sdk/search/azure-resourcemanager-search/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-search/proxy-config.json new file mode 100644 index 0000000000000..a6f7b5df1b3d8 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-search/proxy-config.json @@ -0,0 +1 @@ +[ [ "com.azure.resourcemanager.search.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.search.implementation.AdminKeysClientImpl$AdminKeysService" ], [ "com.azure.resourcemanager.search.implementation.QueryKeysClientImpl$QueryKeysService" ], [ "com.azure.resourcemanager.search.implementation.ServicesClientImpl$ServicesService" ], [ "com.azure.resourcemanager.search.implementation.PrivateLinkResourcesClientImpl$PrivateLinkResourcesService" ], [ "com.azure.resourcemanager.search.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService" ], [ "com.azure.resourcemanager.search.implementation.SharedPrivateLinkResourcesClientImpl$SharedPrivateLinkResourcesService" ], [ "com.azure.resourcemanager.search.implementation.UsagesClientImpl$UsagesService" ], [ "com.azure.resourcemanager.search.implementation.ResourceProvidersClientImpl$ResourceProvidersService" ], [ "com.azure.resourcemanager.search.implementation.NetworkSecurityPerimeterConfigurationsClientImpl$NetworkSecurityPerimeterConfigurationsService" ] ] \ No newline at end of file diff --git a/sdk/search/azure-resourcemanager-search/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-search/reflect-config.json b/sdk/search/azure-resourcemanager-search/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-search/reflect-config.json new file mode 100644 index 0000000000000..c852939597575 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-search/reflect-config.json @@ -0,0 +1,356 @@ +[ { + "name" : "com.azure.resourcemanager.search.models.OperationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.OperationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.OperationDisplay", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.OperationProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.OperationServiceSpecification", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.OperationMetricsSpecification", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.OperationMetricDimension", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.OperationAvailability", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.OperationLogsSpecification", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.AdminKeyResultInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.QueryKeyInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.ListQueryKeysResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.SearchServiceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.SearchServiceProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NetworkRuleSet", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.IpRule", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.EncryptionWithCmk", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.DataPlaneAuthOptions", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.DataPlaneAadOrApiKeyAuthOption", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.PrivateEndpointConnectionProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.PrivateEndpointConnectionPropertiesPrivateEndpoint", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SharedPrivateLinkResourceProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.Sku", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.Identity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.UserAssignedManagedIdentity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SearchServiceUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SearchServiceListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.PrivateLinkResourcesResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.PrivateLinkResourceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.PrivateLinkResourceProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.ShareablePrivateLinkResourceType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.ShareablePrivateLinkResourceProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.PrivateEndpointConnectionListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SharedPrivateLinkResourceListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.CheckNameAvailabilityInput", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.CheckNameAvailabilityOutputInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.QuotaUsagesListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.QuotaUsageResultInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.QuotaUsageResultName", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NetworkSecurityPerimeterConfigurationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.NetworkSecurityPerimeterConfigurationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.fluent.models.NetworkSecurityPerimeterConfigurationProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NspConfigPerimeter", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NspConfigAssociation", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NspConfigProfile", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NspConfigAccessRule", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NspConfigAccessRuleProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NspConfigNetworkSecurityPerimeterRule", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NspProvisioningIssue", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.NspProvisioningIssueProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.PublicNetworkAccess", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SearchBypass", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SearchDisabledDataExfiltrationOption", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SearchSemanticSearch", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.PrivateLinkServiceConnectionProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SharedPrivateLinkResourceStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SharedPrivateLinkResourceProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SkuName", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.IdentityType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.UnavailableNameReason", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.AdminKeyKind", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.HostingMode", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SearchServiceStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.ProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SearchEncryptionWithCmk", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.SearchEncryptionComplianceStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.AadAuthFailureMode", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.search.models.PrivateLinkServiceConnectionStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +} ] \ No newline at end of file diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/AdminKeysGetSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/AdminKeysGetSamples.java new file mode 100644 index 0000000000000..0a308da0abddc --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/AdminKeysGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for AdminKeys Get. + */ +public final class AdminKeysGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchGetAdminKeys.json + */ + /** + * Sample code: SearchGetAdminKeys. + * + * @param manager Entry point to SearchManager. + */ + public static void searchGetAdminKeys(com.azure.resourcemanager.search.SearchManager manager) { + manager.adminKeys().getWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/AdminKeysRegenerateSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/AdminKeysRegenerateSamples.java new file mode 100644 index 0000000000000..906e953a64c2a --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/AdminKeysRegenerateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +import com.azure.resourcemanager.search.models.AdminKeyKind; + +/** + * Samples for AdminKeys Regenerate. + */ +public final class AdminKeysRegenerateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchRegenerateAdminKey.json + */ + /** + * Sample code: SearchRegenerateAdminKey. + * + * @param manager Entry point to SearchManager. + */ + public static void searchRegenerateAdminKey(com.azure.resourcemanager.search.SearchManager manager) { + manager.adminKeys() + .regenerateWithResponse("rg1", "mysearchservice", AdminKeyKind.PRIMARY, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/NetworkSecurityPerimeterConfigurationsGetSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/NetworkSecurityPerimeterConfigurationsGetSamples.java new file mode 100644 index 0000000000000..e814a52e6cc80 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/NetworkSecurityPerimeterConfigurationsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for NetworkSecurityPerimeterConfigurations Get. + */ +public final class NetworkSecurityPerimeterConfigurationsGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurationsGet.json + */ + /** + * Sample code: Get an NSP config by name. + * + * @param manager Entry point to SearchManager. + */ + public static void getAnNSPConfigByName(com.azure.resourcemanager.search.SearchManager manager) { + manager.networkSecurityPerimeterConfigurations() + .getWithResponse("rg1", "mysearchservice", "00000001-2222-3333-4444-111144444444.assoc1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/NetworkSecurityPerimeterConfigurationsListByServiceSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/NetworkSecurityPerimeterConfigurationsListByServiceSamples.java new file mode 100644 index 0000000000000..a7979156d6f87 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/NetworkSecurityPerimeterConfigurationsListByServiceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for NetworkSecurityPerimeterConfigurations ListByService. + */ +public final class NetworkSecurityPerimeterConfigurationsListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurationsListByService.json + */ + /** + * Sample code: List NSP configs by search service. + * + * @param manager Entry point to SearchManager. + */ + public static void listNSPConfigsBySearchService(com.azure.resourcemanager.search.SearchManager manager) { + manager.networkSecurityPerimeterConfigurations() + .listByService("rg1", "mysearchservice", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/NetworkSecurityPerimeterConfigurationsReconcileSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/NetworkSecurityPerimeterConfigurationsReconcileSamples.java new file mode 100644 index 0000000000000..06bb419aeac68 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/NetworkSecurityPerimeterConfigurationsReconcileSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for NetworkSecurityPerimeterConfigurations Reconcile. + */ +public final class NetworkSecurityPerimeterConfigurationsReconcileSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurationsReconcile.json + */ + /** + * Sample code: Reconcile NSP Config. + * + * @param manager Entry point to SearchManager. + */ + public static void reconcileNSPConfig(com.azure.resourcemanager.search.SearchManager manager) { + manager.networkSecurityPerimeterConfigurations() + .reconcile("rg1", "mysearchservice", "00000001-2222-3333-4444-111144444444.assoc1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/OperationsListSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..9bfbd58a29d2b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListOperations.json + */ + /** + * Sample code: SearchListOperations. + * + * @param manager Entry point to SearchManager. + */ + public static void searchListOperations(com.azure.resourcemanager.search.SearchManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..7ed6b16d27462 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/DeletePrivateEndpointConnection.json + */ + /** + * Sample code: PrivateEndpointConnectionDelete. + * + * @param manager Entry point to SearchManager. + */ + public static void privateEndpointConnectionDelete(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateEndpointConnections() + .deleteWithResponse("rg1", "mysearchservice", "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..7f3b34643cc94 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetPrivateEndpointConnection.json + */ + /** + * Sample code: PrivateEndpointConnectionGet. + * + * @param manager Entry point to SearchManager. + */ + public static void privateEndpointConnectionGet(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateEndpointConnections() + .getWithResponse("rg1", "mysearchservice", "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsListByServiceSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsListByServiceSamples.java new file mode 100644 index 0000000000000..5c13736743bdd --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsListByServiceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for PrivateEndpointConnections ListByService. + */ +public final class PrivateEndpointConnectionsListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/ListPrivateEndpointConnectionsByService.json + */ + /** + * Sample code: ListPrivateEndpointConnectionsByService. + * + * @param manager Entry point to SearchManager. + */ + public static void listPrivateEndpointConnectionsByService(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateEndpointConnections() + .listByService("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsUpdateSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsUpdateSamples.java new file mode 100644 index 0000000000000..b2e13b6d1c3a7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.search.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState; +import com.azure.resourcemanager.search.models.PrivateLinkServiceConnectionStatus; + +/** + * Samples for PrivateEndpointConnections Update. + */ +public final class PrivateEndpointConnectionsUpdateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/UpdatePrivateEndpointConnection.json + */ + /** + * Sample code: PrivateEndpointConnectionUpdate. + * + * @param manager Entry point to SearchManager. + */ + public static void privateEndpointConnectionUpdate(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateEndpointConnections() + .updateWithResponse("rg1", "mysearchservice", "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", + new PrivateEndpointConnectionInner() + .withProperties(new PrivateEndpointConnectionProperties().withPrivateLinkServiceConnectionState( + new PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState() + .withStatus(PrivateLinkServiceConnectionStatus.REJECTED) + .withDescription("Rejected for some reason."))), + null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateLinkResourcesListSupportedSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateLinkResourcesListSupportedSamples.java new file mode 100644 index 0000000000000..dea427769f334 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateLinkResourcesListSupportedSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for PrivateLinkResources ListSupported. + */ +public final class PrivateLinkResourcesListSupportedSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/ListSupportedPrivateLinkResources.json + */ + /** + * Sample code: ListSupportedPrivateLinkResources. + * + * @param manager Entry point to SearchManager. + */ + public static void listSupportedPrivateLinkResources(com.azure.resourcemanager.search.SearchManager manager) { + manager.privateLinkResources().listSupported("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysCreateSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysCreateSamples.java new file mode 100644 index 0000000000000..8b28923b20af3 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysCreateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for QueryKeys Create. + */ +public final class QueryKeysCreateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateQueryKey.json + */ + /** + * Sample code: SearchCreateQueryKey. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateQueryKey(com.azure.resourcemanager.search.SearchManager manager) { + manager.queryKeys() + .createWithResponse("rg1", "mysearchservice", + "An API key granting read-only access to the documents collection of an index.", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysDeleteSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysDeleteSamples.java new file mode 100644 index 0000000000000..b1d73cc9f84ab --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for QueryKeys Delete. + */ +public final class QueryKeysDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchDeleteQueryKey.json + */ + /** + * Sample code: SearchDeleteQueryKey. + * + * @param manager Entry point to SearchManager. + */ + public static void searchDeleteQueryKey(com.azure.resourcemanager.search.SearchManager manager) { + manager.queryKeys() + .deleteWithResponse("rg1", "mysearchservice", "", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysListBySearchServiceSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysListBySearchServiceSamples.java new file mode 100644 index 0000000000000..704a5efb8bbcd --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysListBySearchServiceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for QueryKeys ListBySearchService. + */ +public final class QueryKeysListBySearchServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListQueryKeysBySearchService.json + */ + /** + * Sample code: SearchListQueryKeysBySearchService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchListQueryKeysBySearchService(com.azure.resourcemanager.search.SearchManager manager) { + manager.queryKeys().listBySearchService("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ResourceProviderUsageBySubscriptionSkuSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ResourceProviderUsageBySubscriptionSkuSamples.java new file mode 100644 index 0000000000000..bc276fecc8c91 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ResourceProviderUsageBySubscriptionSkuSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for ResourceProvider UsageBySubscriptionSku. + */ +public final class ResourceProviderUsageBySubscriptionSkuSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetQuotaUsage.json + */ + /** + * Sample code: GetQuotaUsage. + * + * @param manager Entry point to SearchManager. + */ + public static void getQuotaUsage(com.azure.resourcemanager.search.SearchManager manager) { + manager.resourceProviders() + .usageBySubscriptionSkuWithResponse("westus", "free", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesCheckNameAvailabilitySamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..41591bb13af13 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesCheckNameAvailabilitySamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +import com.azure.resourcemanager.search.models.CheckNameAvailabilityInput; + +/** + * Samples for Services CheckNameAvailability. + */ +public final class ServicesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCheckNameAvailability.json + */ + /** + * Sample code: SearchCheckNameAvailability. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCheckNameAvailability(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityInput().withName("mysearchservice"), null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesCreateOrUpdateSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d794cd3c883d2 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesCreateOrUpdateSamples.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +import com.azure.resourcemanager.search.models.AadAuthFailureMode; +import com.azure.resourcemanager.search.models.DataPlaneAadOrApiKeyAuthOption; +import com.azure.resourcemanager.search.models.DataPlaneAuthOptions; +import com.azure.resourcemanager.search.models.EncryptionWithCmk; +import com.azure.resourcemanager.search.models.HostingMode; +import com.azure.resourcemanager.search.models.Identity; +import com.azure.resourcemanager.search.models.IdentityType; +import com.azure.resourcemanager.search.models.IpRule; +import com.azure.resourcemanager.search.models.NetworkRuleSet; +import com.azure.resourcemanager.search.models.PublicNetworkAccess; +import com.azure.resourcemanager.search.models.SearchBypass; +import com.azure.resourcemanager.search.models.SearchDisabledDataExfiltrationOption; +import com.azure.resourcemanager.search.models.SearchEncryptionWithCmk; +import com.azure.resourcemanager.search.models.SearchSemanticSearch; +import com.azure.resourcemanager.search.models.Sku; +import com.azure.resourcemanager.search.models.SkuName; +import com.azure.resourcemanager.search.models.UserAssignedManagedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Services CreateOrUpdate. + */ +public final class ServicesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints( + com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateService.json + */ + /** + * Sample code: SearchCreateOrUpdateService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateService(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceAuthOptions.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceAuthOptions. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceAuthOptions(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withAuthOptions(new DataPlaneAuthOptions().withAadOrApiKey(new DataPlaneAadOrApiKeyAuthOption() + .withAadAuthFailureMode(AadAuthFailureMode.HTTP401WITH_BEARER_CHALLENGE))) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateWithSemanticSearch.json + */ + /** + * Sample code: SearchCreateOrUpdateWithSemanticSearch. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateWithSemanticSearch(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withSemanticSearch(SearchSemanticSearch.FREE) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceWithIdentity.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceWithIdentity. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceWithIdentity(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withIdentity(new Identity().withType(IdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi", + new UserAssignedManagedIdentity()))) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass( + com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(1) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withNetworkRuleSet(new NetworkRuleSet() + .withIpRules(Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18"))) + .withBypass(SearchBypass.AZURE_PORTAL)) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceDisableLocalAuth. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchCreateOrUpdateServiceDisableLocalAuth(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withDisableLocalAuth(true) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs. + * + * @param manager Entry point to SearchManager. + */ + public static void searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs( + com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(1) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withNetworkRuleSet(new NetworkRuleSet().withIpRules( + Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18")))) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceWithCmkEnforcement. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchCreateOrUpdateServiceWithCmkEnforcement(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withEncryptionWithCmk(new EncryptionWithCmk().withEnforcement(SearchEncryptionWithCmk.ENABLED)) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceWithDataExfiltration.json + */ + /** + * Sample code: SearchCreateOrUpdateServiceWithDataExfiltration. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchCreateOrUpdateServiceWithDataExfiltration(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .define("mysearchservice") + .withRegion("westus") + .withExistingResourceGroup("rg1") + .withTags(mapOf("app-name", "My e-commerce app")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .withDisabledDataExfiltrationOptions(Arrays.asList(SearchDisabledDataExfiltrationOption.ALL)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesDeleteSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesDeleteSamples.java new file mode 100644 index 0000000000000..c8795a0908a4c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for Services Delete. + */ +public final class ServicesDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchDeleteService.json + */ + /** + * Sample code: SearchDeleteService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchDeleteService(com.azure.resourcemanager.search.SearchManager manager) { + manager.services().deleteWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesGetByResourceGroupSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c61278cd9516b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for Services GetByResourceGroup. + */ +public final class ServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchGetService.json + */ + /** + * Sample code: SearchGetService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchGetService(com.azure.resourcemanager.search.SearchManager manager) { + manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesListByResourceGroupSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..771620b62363a --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for Services ListByResourceGroup. + */ +public final class ServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListServicesByResourceGroup.json + */ + /** + * Sample code: SearchListServicesByResourceGroup. + * + * @param manager Entry point to SearchManager. + */ + public static void searchListServicesByResourceGroup(com.azure.resourcemanager.search.SearchManager manager) { + manager.services().listByResourceGroup("rg1", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesListSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesListSamples.java new file mode 100644 index 0000000000000..331e9b4b2310c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for Services List. + */ +public final class ServicesListSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListServicesBySubscription.json + */ + /** + * Sample code: SearchListServicesBySubscription. + * + * @param manager Entry point to SearchManager. + */ + public static void searchListServicesBySubscription(com.azure.resourcemanager.search.SearchManager manager) { + manager.services().list(null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesUpdateSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesUpdateSamples.java new file mode 100644 index 0000000000000..15fa8a2e8f171 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesUpdateSamples.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +import com.azure.resourcemanager.search.models.AadAuthFailureMode; +import com.azure.resourcemanager.search.models.DataPlaneAadOrApiKeyAuthOption; +import com.azure.resourcemanager.search.models.DataPlaneAuthOptions; +import com.azure.resourcemanager.search.models.EncryptionWithCmk; +import com.azure.resourcemanager.search.models.Identity; +import com.azure.resourcemanager.search.models.IdentityType; +import com.azure.resourcemanager.search.models.IpRule; +import com.azure.resourcemanager.search.models.NetworkRuleSet; +import com.azure.resourcemanager.search.models.PublicNetworkAccess; +import com.azure.resourcemanager.search.models.SearchBypass; +import com.azure.resourcemanager.search.models.SearchDisabledDataExfiltrationOption; +import com.azure.resourcemanager.search.models.SearchEncryptionWithCmk; +import com.azure.resourcemanager.search.models.SearchSemanticSearch; +import com.azure.resourcemanager.search.models.SearchService; +import com.azure.resourcemanager.search.models.Sku; +import com.azure.resourcemanager.search.models.SkuName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Services Update. + */ +public final class ServicesUpdateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceDisableLocalAuth.json + */ + /** + * Sample code: SearchUpdateServiceDisableLocalAuth. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceDisableLocalAuth(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withDisableLocalAuth(true) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json + */ + /** + * Sample code: SearchUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass( + com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withReplicaCount(3) + .withPartitionCount(1) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withNetworkRuleSet(new NetworkRuleSet() + .withIpRules(Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18"))) + .withBypass(SearchBypass.AZURE_PORTAL)) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceWithCmkEnforcement.json + */ + /** + * Sample code: SearchUpdateServiceWithCmkEnforcement. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceWithCmkEnforcement(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withEncryptionWithCmk(new EncryptionWithCmk().withEnforcement(SearchEncryptionWithCmk.ENABLED)) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceWithDataExfiltration.json + */ + /** + * Sample code: SearchUpdateServiceWithDataExfiltration. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceWithDataExfiltration(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withDisabledDataExfiltrationOptions(Arrays.asList(SearchDisabledDataExfiltrationOption.ALL)) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToRemoveIdentity.json + */ + /** + * Sample code: SearchUpdateServiceToRemoveIdentity. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceToRemoveIdentity(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withSku(new Sku().withName(SkuName.STANDARD)) + .withIdentity(new Identity().withType(IdentityType.NONE)) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceWithSemanticSearch.json + */ + /** + * Sample code: SearchUpdateServiceWithSemanticSearch. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceWithSemanticSearch(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withSemanticSearch(SearchSemanticSearch.STANDARD) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json + */ + /** + * Sample code: SearchUpdateServiceToAllowAccessFromPrivateEndpoints. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchUpdateServiceToAllowAccessFromPrivateEndpoints(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withReplicaCount(1) + .withPartitionCount(1) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json + */ + /** + * Sample code: SearchUpdateServiceToAllowAccessFromPublicCustomIPs. + * + * @param manager Entry point to SearchManager. + */ + public static void + searchUpdateServiceToAllowAccessFromPublicCustomIPs(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withReplicaCount(3) + .withPartitionCount(1) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withNetworkRuleSet(new NetworkRuleSet().withIpRules( + Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18")))) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceAuthOptions.json + */ + /** + * Sample code: SearchUpdateServiceAuthOptions. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateServiceAuthOptions(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .withAuthOptions(new DataPlaneAuthOptions().withAadOrApiKey(new DataPlaneAadOrApiKeyAuthOption() + .withAadAuthFailureMode(AadAuthFailureMode.HTTP401WITH_BEARER_CHALLENGE))) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateService.json + */ + /** + * Sample code: SearchUpdateService. + * + * @param manager Entry point to SearchManager. + */ + public static void searchUpdateService(com.azure.resourcemanager.search.SearchManager manager) { + SearchService resource = manager.services() + .getByResourceGroupWithResponse("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesCreateOrUpdateSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0bc163ddb35e4 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +import com.azure.resourcemanager.search.models.SharedPrivateLinkResourceProperties; + +/** + * Samples for SharedPrivateLinkResources CreateOrUpdate. + */ +public final class SharedPrivateLinkResourcesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/CreateOrUpdateSharedPrivateLinkResource.json + */ + /** + * Sample code: SharedPrivateLinkResourceCreateOrUpdate. + * + * @param manager Entry point to SearchManager. + */ + public static void sharedPrivateLinkResourceCreateOrUpdate(com.azure.resourcemanager.search.SearchManager manager) { + manager.sharedPrivateLinkResources() + .define("testResource") + .withExistingSearchService("rg1", "mysearchservice") + .withProperties(new SharedPrivateLinkResourceProperties().withPrivateLinkResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName") + .withGroupId("blob") + .withRequestMessage("please approve")) + .create(); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesDeleteSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesDeleteSamples.java new file mode 100644 index 0000000000000..c2a94f45fbd61 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for SharedPrivateLinkResources Delete. + */ +public final class SharedPrivateLinkResourcesDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/DeleteSharedPrivateLinkResource.json + */ + /** + * Sample code: SharedPrivateLinkResourceDelete. + * + * @param manager Entry point to SearchManager. + */ + public static void sharedPrivateLinkResourceDelete(com.azure.resourcemanager.search.SearchManager manager) { + manager.sharedPrivateLinkResources() + .delete("rg1", "mysearchservice", "testResource", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesGetSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..30df521c4ac8d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for SharedPrivateLinkResources Get. + */ +public final class SharedPrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetSharedPrivateLinkResource.json + */ + /** + * Sample code: SharedPrivateLinkResourceGet. + * + * @param manager Entry point to SearchManager. + */ + public static void sharedPrivateLinkResourceGet(com.azure.resourcemanager.search.SearchManager manager) { + manager.sharedPrivateLinkResources() + .getWithResponse("rg1", "mysearchservice", "testResource", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesListByServiceSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesListByServiceSamples.java new file mode 100644 index 0000000000000..8883250069260 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesListByServiceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for SharedPrivateLinkResources ListByService. + */ +public final class SharedPrivateLinkResourcesListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/ListSharedPrivateLinkResourcesByService.json + */ + /** + * Sample code: ListSharedPrivateLinkResourcesByService. + * + * @param manager Entry point to SearchManager. + */ + public static void listSharedPrivateLinkResourcesByService(com.azure.resourcemanager.search.SearchManager manager) { + manager.sharedPrivateLinkResources() + .listByService("rg1", "mysearchservice", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/UsagesListBySubscriptionSamples.java b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/UsagesListBySubscriptionSamples.java new file mode 100644 index 0000000000000..9d6ba465a943c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/UsagesListBySubscriptionSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.search.generated; + +/** + * Samples for Usages ListBySubscription. + */ +public final class UsagesListBySubscriptionSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetQuotaUsagesList.json + */ + /** + * Sample code: GetQuotaUsagesList. + * + * @param manager Entry point to SearchManager. + */ + public static void getQuotaUsagesList(com.azure.resourcemanager.search.SearchManager manager) { + manager.usages().listBySubscription("westus", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/search/ci.yml b/sdk/search/ci.yml index ae718ecb72a72..904ec5bb5debf 100644 --- a/sdk/search/ci.yml +++ b/sdk/search/ci.yml @@ -1,4 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + trigger: branches: include: @@ -42,9 +43,11 @@ extends: - name: azure-search-documents groupId: com.azure safeName: azuresearch + - name: azure-resourcemanager-search + groupId: com.azure.resourcemanager + safeName: azureresourcemanagersearch AdditionalModules: - name: azure-search-perf groupId: com.azure - # required by the above perf library - name: perf-test-core groupId: com.azure diff --git a/sdk/search/pom.xml b/sdk/search/pom.xml index 913477ed5abea..3c3c6066d8d57 100644 --- a/sdk/search/pom.xml +++ b/sdk/search/pom.xml @@ -9,8 +9,9 @@ pom 1.0.0 - azure-search-documents - azure-search-perf + azure-resourcemanager-search + azure-search-documents + azure-search-perf