From 8040cdf3596f1bedf36a910c6ff8b1659bb977a6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 3 Mar 2022 10:42:13 +0000 Subject: [PATCH] CodeGen from PR 18082 in Azure/azure-rest-api-specs Merge 9b7783ce0ebfc952c95ae3d619d57652aa0dbb85 into d0b5e9937f89a600dd25c1aa450b42fe911e067d --- .../azure-resourcemanager-search/CHANGELOG.md | 5 + .../azure-resourcemanager-search/README.md | 102 + .../azure-resourcemanager-search/SAMPLE.md | 720 ++++++ .../azure-resourcemanager-search/pom.xml | 55 + .../resourcemanager/search/SearchManager.java | 316 +++ .../search/fluent/AdminKeysClient.java | 92 + .../search/fluent/OperationsClient.java | 36 + .../PrivateEndpointConnectionsClient.java | 190 ++ .../fluent/PrivateLinkResourcesClient.java | 51 + .../search/fluent/QueryKeysClient.java | 127 ++ .../search/fluent/SearchManagementClient.java | 96 + .../search/fluent/ServicesClient.java | 335 +++ .../SharedPrivateLinkResourcesClient.java | 336 +++ .../fluent/models/AdminKeyResultInner.java | 54 + .../CheckNameAvailabilityOutputInner.java | 78 + .../search/fluent/models/OperationInner.java | 59 + .../PrivateEndpointConnectionInner.java | 58 + .../models/PrivateLinkResourceInner.java | 46 + .../search/fluent/models/QueryKeyInner.java | 54 + .../fluent/models/SearchServiceInner.java | 321 +++ .../models/SearchServiceProperties.java | 315 +++ .../SharedPrivateLinkResourceInner.java | 58 + .../search/fluent/models/package-info.java | 9 + .../search/fluent/package-info.java | 9 + .../implementation/AdminKeyResultImpl.java | 35 + .../implementation/AdminKeysClientImpl.java | 524 +++++ .../search/implementation/AdminKeysImpl.java | 92 + .../CheckNameAvailabilityOutputImpl.java | 41 + .../search/implementation/OperationImpl.java | 36 + .../implementation/OperationsClientImpl.java | 178 ++ .../search/implementation/OperationsImpl.java | 45 + .../PrivateEndpointConnectionImpl.java | 45 + .../PrivateEndpointConnectionsClientImpl.java | 1269 +++++++++++ .../PrivateEndpointConnectionsImpl.java | 162 ++ .../PrivateLinkResourceImpl.java | 45 + .../PrivateLinkResourcesClientImpl.java | 302 +++ .../PrivateLinkResourcesImpl.java | 50 + .../search/implementation/QueryKeyImpl.java | 35 + .../implementation/QueryKeysClientImpl.java | 867 ++++++++ .../search/implementation/QueryKeysImpl.java | 88 + .../SearchManagementClientBuilder.java | 148 ++ .../SearchManagementClientImpl.java | 382 ++++ .../implementation/SearchServiceImpl.java | 346 +++ .../implementation/ServicesClientImpl.java | 1981 +++++++++++++++++ .../search/implementation/ServicesImpl.java | 212 ++ .../SharedPrivateLinkResourceImpl.java | 186 ++ .../SharedPrivateLinkResourcesClientImpl.java | 1655 ++++++++++++++ .../SharedPrivateLinkResourcesImpl.java | 247 ++ .../search/implementation/Utils.java | 204 ++ .../search/implementation/package-info.java | 9 + .../search/models/AdminKeyKind.java | 47 + .../search/models/AdminKeyResult.java | 31 + .../search/models/AdminKeys.java | 84 + .../models/CheckNameAvailabilityInput.java | 96 + .../models/CheckNameAvailabilityOutput.java | 41 + .../search/models/HostingMode.java | 47 + .../search/models/Identity.java | 84 + .../search/models/IdentityType.java | 47 + .../resourcemanager/search/models/IpRule.java | 53 + .../search/models/ListQueryKeysResult.java | 61 + .../search/models/NetworkRuleSet.java | 68 + .../search/models/Operation.java | 31 + .../search/models/OperationDisplay.java | 84 + .../search/models/OperationListResult.java | 62 + .../search/models/Operations.java | 31 + .../models/PrivateEndpointConnection.java | 46 + .../PrivateEndpointConnectionListResult.java | 62 + .../PrivateEndpointConnectionProperties.java | 87 + ...ntConnectionPropertiesPrivateEndpoint.java | 52 + ...tiesPrivateLinkServiceConnectionState.java | 109 + .../models/PrivateEndpointConnections.java | 180 ++ .../search/models/PrivateLinkResource.java | 46 + .../models/PrivateLinkResourceProperties.java | 93 + .../search/models/PrivateLinkResources.java | 46 + .../models/PrivateLinkResourcesResult.java | 44 + .../PrivateLinkServiceConnectionStatus.java | 53 + .../search/models/ProvisioningState.java | 50 + .../search/models/PublicNetworkAccess.java | 47 + .../search/models/QueryKey.java | 31 + .../search/models/QueryKeys.java | 118 + .../search/models/SearchService.java | 527 +++++ .../models/SearchServiceListResult.java | 62 + .../search/models/SearchServiceStatus.java | 59 + .../search/models/SearchServiceUpdate.java | 364 +++ .../search/models/Services.java | 212 ++ ...hareablePrivateLinkResourceProperties.java | 78 + .../ShareablePrivateLinkResourceType.java | 61 + .../models/SharedPrivateLinkResource.java | 181 ++ .../SharedPrivateLinkResourceListResult.java | 71 + .../SharedPrivateLinkResourceProperties.java | 198 ++ ...dPrivateLinkResourceProvisioningState.java | 56 + .../SharedPrivateLinkResourceStatus.java | 53 + .../models/SharedPrivateLinkResources.java | 204 ++ .../resourcemanager/search/models/Sku.java | 68 + .../search/models/SkuName.java | 62 + .../search/models/UnavailableNameReason.java | 34 + .../search/models/package-info.java | 9 + .../resourcemanager/search/package-info.java | 9 + .../src/main/java/module-info.java | 19 + .../search/generated/AdminKeysGetSamples.java | 22 + .../generated/AdminKeysRegenerateSamples.java | 23 + ...ivateEndpointConnectionsDeleteSamples.java | 25 + .../PrivateEndpointConnectionsGetSamples.java | 25 + ...dpointConnectionsListByServiceSamples.java | 22 + ...ivateEndpointConnectionsUpdateSamples.java | 40 + ...vateLinkResourcesListSupportedSamples.java | 22 + .../generated/QueryKeysCreateSamples.java | 24 + .../generated/QueryKeysDeleteSamples.java | 22 + .../QueryKeysListBySearchServiceSamples.java | 22 + .../ServicesCheckNameAvailabilitySamples.java | 26 + .../ServicesCreateOrUpdateSamples.java | 127 ++ .../generated/ServicesDeleteSamples.java | 22 + .../ServicesGetByResourceGroupSamples.java | 22 + .../ServicesListByResourceGroupSamples.java | 22 + .../search/generated/ServicesListSamples.java | 22 + .../generated/ServicesUpdateSamples.java | 112 + ...ateLinkResourcesCreateOrUpdateSamples.java | 32 + ...aredPrivateLinkResourcesDeleteSamples.java | 22 + .../SharedPrivateLinkResourcesGetSamples.java | 24 + ...vateLinkResourcesListByServiceSamples.java | 22 + sdk/search/ci.yml | 4 + sdk/search/pom.xml | 1 + 122 files changed, 17669 insertions(+) create mode 100644 sdk/search/azure-resourcemanager-search/CHANGELOG.md create mode 100644 sdk/search/azure-resourcemanager-search/README.md create mode 100644 sdk/search/azure-resourcemanager-search/SAMPLE.md create mode 100644 sdk/search/azure-resourcemanager-search/pom.xml create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/SearchManager.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/AdminKeysClient.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/OperationsClient.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/PrivateEndpointConnectionsClient.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/PrivateLinkResourcesClient.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/QueryKeysClient.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SearchManagementClient.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/ServicesClient.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SharedPrivateLinkResourcesClient.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/AdminKeyResultInner.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/CheckNameAvailabilityOutputInner.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/OperationInner.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateEndpointConnectionInner.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateLinkResourceInner.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/QueryKeyInner.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceInner.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceProperties.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SharedPrivateLinkResourceInner.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/package-info.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/package-info.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeyResultImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysClientImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/CheckNameAvailabilityOutputImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsClientImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourceImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesClientImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeyImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysClientImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientBuilder.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchServiceImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesClientImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourceImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesClientImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesImpl.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/Utils.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/package-info.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyKind.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyResult.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeys.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityInput.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityOutput.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/HostingMode.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Identity.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IdentityType.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IpRule.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ListQueryKeysResult.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkRuleSet.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operation.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationDisplay.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationListResult.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operations.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnection.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionListResult.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionProperties.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateEndpoint.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnections.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResource.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourceProperties.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResources.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourcesResult.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkServiceConnectionStatus.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ProvisioningState.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PublicNetworkAccess.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKey.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKeys.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchService.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceListResult.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceStatus.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceUpdate.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Services.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceProperties.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceType.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResource.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceListResult.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProperties.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProvisioningState.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceStatus.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResources.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Sku.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SkuName.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/UnavailableNameReason.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/package-info.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/package-info.java create mode 100644 sdk/search/azure-resourcemanager-search/src/main/java/module-info.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/AdminKeysGetSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/AdminKeysRegenerateSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsDeleteSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsGetSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsListByServiceSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsUpdateSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateLinkResourcesListSupportedSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysCreateSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysDeleteSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysListBySearchServiceSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesCheckNameAvailabilitySamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesCreateOrUpdateSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesDeleteSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesGetByResourceGroupSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesListByResourceGroupSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesListSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesUpdateSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesCreateOrUpdateSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesDeleteSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesGetSamples.java create mode 100644 sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesListByServiceSamples.java diff --git a/sdk/search/azure-resourcemanager-search/CHANGELOG.md b/sdk/search/azure-resourcemanager-search/CHANGELOG.md new file mode 100644 index 000000000000..f1ab8c480553 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-03-03) + +- 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 Cognitive Search services and API keys. Package tag package-2020-08. 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 000000000000..26346cc9251b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/README.md @@ -0,0 +1,102 @@ +# 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 Cognitive Search services and API keys. Package tag package-2020-08. 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.13.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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of 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 environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by 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](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[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 diff --git a/sdk/search/azure-resourcemanager-search/SAMPLE.md b/sdk/search/azure-resourcemanager-search/SAMPLE.md new file mode 100644 index 000000000000..df8126e732db --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/SAMPLE.md @@ -0,0 +1,720 @@ +# Code snippets and samples + + +## AdminKeys + +- [Get](#adminkeys_get) +- [Regenerate](#adminkeys_regenerate) + +## 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) + +## 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) +### AdminKeys_Get + +```java +import com.azure.core.util.Context; + +/** Samples for AdminKeys Get. */ +public final class AdminKeysGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### AdminKeys_Regenerate + +```java +import com.azure.core.util.Context; +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/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByService + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByService. */ +public final class PrivateEndpointConnectionsListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Update + +```java +import com.azure.core.util.Context; +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/stable/2020-08-01/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, + Context.NONE); + } +} +``` + +### PrivateLinkResources_ListSupported + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListSupported. */ +public final class PrivateLinkResourcesListSupportedSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### QueryKeys_Create + +```java +import com.azure.core.util.Context; + +/** Samples for QueryKeys Create. */ +public final class QueryKeysCreateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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", "Query key for browser-based clients", null, Context.NONE); + } +} +``` + +### QueryKeys_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for QueryKeys Delete. */ +public final class QueryKeysDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### QueryKeys_ListBySearchService + +```java +import com.azure.core.util.Context; + +/** Samples for QueryKeys ListBySearchService. */ +public final class QueryKeysListBySearchServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### Services_CheckNameAvailability + +```java +import com.azure.core.util.Context; +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/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### Services_CreateOrUpdate + +```java +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.Sku; +import com.azure.resourcemanager.search.models.SkuName; +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/stable/2020-08-01/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/stable/2020-08-01/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/stable/2020-08-01/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)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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(); + } + + @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 +import com.azure.core.util.Context; + +/** Samples for Services Delete. */ +public final class ServicesDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### Services_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Services GetByResourceGroup. */ +public final class ServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### Services_List + +```java +import com.azure.core.util.Context; + +/** Samples for Services List. */ +public final class ServicesListSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### Services_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Services ListByResourceGroup. */ +public final class ServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### Services_Update + +```java +import com.azure.core.util.Context; +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.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/stable/2020-08-01/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, 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/stable/2020-08-01/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, 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/stable/2020-08-01/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, Context.NONE).getValue(); + resource + .update() + .withReplicaCount(1) + .withPartitionCount(1) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .apply(); + } + + @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/stable/2020-08-01/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 +import com.azure.core.util.Context; + +/** Samples for SharedPrivateLinkResources Delete. */ +public final class SharedPrivateLinkResourcesDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### SharedPrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SharedPrivateLinkResources Get. */ +public final class SharedPrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} +``` + +### SharedPrivateLinkResources_ListByService + +```java +import com.azure.core.util.Context; + +/** Samples for SharedPrivateLinkResources ListByService. */ +public final class SharedPrivateLinkResourcesListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..0e2c53edfd52 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-search + 2.13.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 Cognitive Search services and API keys. Package tag package-2020-08. + 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 + true + + + + com.azure + azure-core + 1.25.0 + + + com.azure + azure-core-management + 1.5.2 + + + 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 000000000000..91e3284d9878 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/SearchManager.java @@ -0,0 +1,316 @@ +// 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.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +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.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.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.SearchManagementClientBuilder; +import com.azure.resourcemanager.search.implementation.ServicesImpl; +import com.azure.resourcemanager.search.implementation.SharedPrivateLinkResourcesImpl; +import com.azure.resourcemanager.search.models.AdminKeys; +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.Services; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResources; +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 Cognitive 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 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); + } + + /** + * 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 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 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' 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) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of AdminKeys. */ + public AdminKeys adminKeys() { + if (this.adminKeys == null) { + this.adminKeys = new AdminKeysImpl(clientObject.getAdminKeys(), this); + } + return adminKeys; + } + + /** @return Resource collection API of QueryKeys. */ + public QueryKeys queryKeys() { + if (this.queryKeys == null) { + this.queryKeys = new QueryKeysImpl(clientObject.getQueryKeys(), this); + } + return queryKeys; + } + + /** @return Resource collection API of Services. */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(clientObject.getServices(), this); + } + return services; + } + + /** @return Resource collection API of PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** @return Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** @return Resource collection API of SharedPrivateLinkResources. */ + public SharedPrivateLinkResources sharedPrivateLinkResources() { + if (this.sharedPrivateLinkResources == null) { + this.sharedPrivateLinkResources = + new SharedPrivateLinkResourcesImpl(clientObject.getSharedPrivateLinkResources(), this); + } + return sharedPrivateLinkResources; + } + + /** + * @return Wrapped service client SearchManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + 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 000000000000..2a4b56011902 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/AdminKeysClient.java @@ -0,0 +1,92 @@ +// 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 Cognitive 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 Cognitive 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdminKeyResultInner get(String resourceGroupName, String searchServiceName); + + /** + * Gets the primary and secondary admin API keys for the specified Azure Cognitive 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 Cognitive 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 Cognitive Search service along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String searchServiceName, 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 Cognitive 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdminKeyResultInner regenerate(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind); + + /** + * 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 Cognitive 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 Cognitive Search service + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateWithResponse( + String resourceGroupName, + String searchServiceName, + AdminKeyKind keyKind, + UUID clientRequestId, + 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 000000000000..682c2eaab12c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// 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 000000000000..27151fff82be --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,190 @@ +// 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner update( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner delete( + 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + UUID clientRequestId, + Context 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 Cognitive 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 Cognitive 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 000000000000..9afcdbfcbe6b --- /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 Cognitive 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 Cognitive 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 000000000000..804d41b6b674 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/QueryKeysClient.java @@ -0,0 +1,127 @@ +// 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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryKeyInner create(String resourceGroupName, String searchServiceName, String name); + + /** + * 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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, String searchServiceName, String name, UUID clientRequestId, Context context); + + /** + * Returns the list of query API keys for the given Azure Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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); + + /** + * 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 Cognitive 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); +} 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 000000000000..26e1fb315f17 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SearchManagementClient.java @@ -0,0 +1,96 @@ +// 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(); +} 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 000000000000..d41378a32784 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/ServicesClient.java @@ -0,0 +1,335 @@ +// 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 Cognitive 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 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 Cognitive Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SearchServiceInner> beginCreateOrUpdate( + String resourceGroupName, String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId); + + /** + * 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 Cognitive 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 Cognitive 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 Cognitive 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 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 Cognitive Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SearchServiceInner createOrUpdate( + String resourceGroupName, String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId); + + /** + * 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SearchServiceInner update(String resourceGroupName, String searchServiceName, SearchServiceUpdate serviceParam); + + /** + * 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 Cognitive 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 Cognitive 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); + + /** + * 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 Cognitive 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); + + /** + * 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 Cognitive 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); + + /** + * 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 Cognitive 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); + + /** + * 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 Cognitive 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); + + /** + * 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. + * @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); + + /** + * 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); +} 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 000000000000..cad693de641b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/SharedPrivateLinkResourcesClient.java @@ -0,0 +1,336 @@ +// 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 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 + * Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SharedPrivateLinkResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String searchServiceName, + String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 + * Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedPrivateLinkResourceInner createOrUpdate( + String resourceGroupName, + String searchServiceName, + String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive 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/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 000000000000..8d140cee9a29 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/AdminKeyResultInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response containing the primary and secondary admin API keys for a given Azure Cognitive Search service. */ +@Immutable +public final class AdminKeyResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdminKeyResultInner.class); + + /* + * 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; + + /** + * 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 000000000000..7eccc28902e7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/CheckNameAvailabilityOutputInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.models.UnavailableNameReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Output of check name availability API. */ +@Immutable +public final class CheckNameAvailabilityOutputInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityOutputInner.class); + + /* + * 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; + + /** + * 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/OperationInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/OperationInner.java new file mode 100644 index 000000000000..684b286f9624 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/OperationInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a REST API operation. */ +@Immutable +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * 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; + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().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 000000000000..a66b39bcc51c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateEndpointConnectionInner.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.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.models.PrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an existing Private Endpoint connection to the Azure Cognitive Search service. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * Describes the properties of an existing Private Endpoint connection to + * the Azure Cognitive Search service. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties properties; + + /** + * Get the properties property: Describes the properties of an existing Private Endpoint connection to the Azure + * Cognitive 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 + * Cognitive 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 000000000000..654532fa973f --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/PrivateLinkResourceInner.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.models.PrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a supported private link resource for the Azure Cognitive Search service. */ +@Immutable +public final class PrivateLinkResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceInner.class); + + /* + * Describes the properties of a supported private link resource for the + * Azure Cognitive Search service. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkResourceProperties properties; + + /** + * Get the properties property: Describes the properties of a supported private link resource for the Azure + * Cognitive 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 000000000000..88f0fff80d26 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/QueryKeyInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an API key for a given Azure Cognitive Search service that has permissions for query operations only. */ +@Immutable +public final class QueryKeyInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryKeyInner.class); + + /* + * The name of the query API key; may be empty. + */ + @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; + + /** + * Get the name property: The name of the query API key; may be empty. + * + * @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/SearchServiceInner.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceInner.java new file mode 100644 index 000000000000..089508e1c466 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceInner.java @@ -0,0 +1,321 @@ +// 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.core.util.logging.ClientLogger; +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.SearchServiceStatus; +import com.azure.resourcemanager.search.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Describes an Azure Cognitive Search service and its current state. */ +@Fluent +public final class SearchServiceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SearchServiceInner.class); + + /* + * 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; + + /** + * 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. If your service is in the degraded, disabled, or error states, it means the Azure Cognitive 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 Cognitive 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 Cognitive 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 privateEndpointConnections property: The list of private endpoint connections to the Azure Cognitive + * 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 + * Cognitive Search service. + * + * @return the sharedPrivateLinkResources value. + */ + public List sharedPrivateLinkResources() { + return this.innerProperties() == null ? null : this.innerProperties().sharedPrivateLinkResources(); + } + + /** + * 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 000000000000..af65f355acd9 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SearchServiceProperties.java @@ -0,0 +1,315 @@ +// 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.util.logging.ClientLogger; +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.SearchServiceStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of the search service. */ +@Fluent +public final class SearchServiceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SearchServiceProperties.class); + + /* + * 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. If your service is in the degraded, + * disabled, or error states, it means the Azure Cognitive 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 Cognitive Search + * service may be reached. + */ + @JsonProperty(value = "networkRuleSet") + private NetworkRuleSet networkRuleSet; + + /* + * The list of private endpoint connections to the Azure Cognitive Search + * service. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * The list of shared private link resources managed by the Azure Cognitive + * Search service. + */ + @JsonProperty(value = "sharedPrivateLinkResources", access = JsonProperty.Access.WRITE_ONLY) + private List sharedPrivateLinkResources; + + /** + * 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. If your service is in the degraded, disabled, or error states, it means the Azure Cognitive 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 Cognitive 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 Cognitive 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 privateEndpointConnections property: The list of private endpoint connections to the Azure Cognitive + * 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 + * Cognitive Search service. + * + * @return the sharedPrivateLinkResources value. + */ + public List sharedPrivateLinkResources() { + return this.sharedPrivateLinkResources; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkRuleSet() != null) { + networkRuleSet().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 000000000000..1ee749b1015d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/fluent/models/SharedPrivateLinkResourceInner.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.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.models.SharedPrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a Shared Private Link Resource managed by the Azure Cognitive Search service. */ +@Fluent +public final class SharedPrivateLinkResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedPrivateLinkResourceInner.class); + + /* + * Describes the properties of a Shared Private Link Resource managed by + * the Azure Cognitive Search service. + */ + @JsonProperty(value = "properties") + private SharedPrivateLinkResourceProperties properties; + + /** + * Get the properties property: Describes the properties of a Shared Private Link Resource managed by the Azure + * Cognitive 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 + * Cognitive 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 000000000000..f709afc865d1 --- /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 + * Cognitive 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 000000000000..f19f6b05ea5e --- /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 Cognitive + * 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 000000000000..6b4f9315b9ab --- /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 000000000000..05ecbac6089d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysClientImpl.java @@ -0,0 +1,524 @@ +// 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.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 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 { + private final ClientLogger logger = new ClientLogger(AdminKeysClientImpl.class); + + /** 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") + private 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive Search service on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String searchServiceName, UUID clientRequestId) { + return getWithResponseAsync(resourceGroupName, searchServiceName, clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Cognitive 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 Cognitive 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 Cognitive 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Cognitive 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 Cognitive 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdminKeyResultInner get(String resourceGroupName, String searchServiceName) { + final UUID clientRequestId = null; + return getAsync(resourceGroupName, searchServiceName, clientRequestId).block(); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Cognitive 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 Cognitive 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 Cognitive 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(); + } + + /** + * 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive Search service + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateAsync( + String resourceGroupName, String searchServiceName, AdminKeyKind keyKind, UUID clientRequestId) { + return regenerateWithResponseAsync(resourceGroupName, searchServiceName, keyKind, clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive 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 Cognitive 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdminKeyResultInner regenerate(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind) { + final UUID clientRequestId = null; + return regenerateAsync(resourceGroupName, searchServiceName, keyKind, clientRequestId).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 Cognitive 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 Cognitive 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(); + } +} 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 000000000000..36237de3855e --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/AdminKeysImpl.java @@ -0,0 +1,92 @@ +// 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 com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.UUID; + +public final class AdminKeysImpl implements AdminKeys { + @JsonIgnore private 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 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 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 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; + } + } + + 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; + } + } + + 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 000000000000..95a6f195e444 --- /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/OperationImpl.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationImpl.java new file mode 100644 index 000000000000..357e9e5834b7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationImpl.java @@ -0,0 +1,36 @@ +// 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; + +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 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 000000000000..76e2aa962831 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsClientImpl.java @@ -0,0 +1,178 @@ +// 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.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.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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** 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") + private 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 000000000000..049907f3b6bc --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/OperationsImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private 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 Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.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 000000000000..9ae371671e57 --- /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 000000000000..4769187e1789 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1269 @@ +// 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.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.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 { + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsClientImpl.class); + + /** 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") + private 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + UUID clientRequestId) { + return updateWithResponseAsync( + resourceGroupName, + searchServiceName, + privateEndpointConnectionName, + privateEndpointConnection, + clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner update( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection) { + final UUID clientRequestId = null; + return updateAsync( + resourceGroupName, + searchServiceName, + privateEndpointConnectionName, + privateEndpointConnection, + clientRequestId) + .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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive 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(); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + UUID clientRequestId) { + return getWithResponseAsync( + resourceGroupName, searchServiceName, privateEndpointConnectionName, clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 getAsync(resourceGroupName, searchServiceName, privateEndpointConnectionName, clientRequestId).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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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(); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + UUID clientRequestId) { + return deleteWithResponseAsync( + resourceGroupName, searchServiceName, privateEndpointConnectionName, clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner delete( + String resourceGroupName, String searchServiceName, String privateEndpointConnectionName) { + final UUID clientRequestId = null; + return deleteAsync(resourceGroupName, searchServiceName, privateEndpointConnectionName, clientRequestId) + .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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive 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(); + } + + /** + * 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 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 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 000000000000..06339e0a2d1a --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,162 @@ +// 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 com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.UUID; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + @JsonIgnore private 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 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 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 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 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 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 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 PagedIterable listByService(String resourceGroupName, String searchServiceName) { + PagedIterable inner = + this.serviceClient().listByService(resourceGroupName, searchServiceName); + return Utils.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 Utils.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 000000000000..c591bac9ffe3 --- /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 000000000000..cc8f21b82efc --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,302 @@ +// 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.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.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 { + private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesClientImpl.class); + + /** 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") + private 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 000000000000..d0c5fca174bd --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,50 @@ +// 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 com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.UUID; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + @JsonIgnore private 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 Utils.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 Utils.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 000000000000..62ab2b4f493f --- /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 000000000000..209541fae09d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysClientImpl.java @@ -0,0 +1,867 @@ +// 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.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.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 { + private final ClientLogger logger = new ClientLogger(QueryKeysClientImpl.class); + + /** 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") + private 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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only 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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only 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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String searchServiceName, String name, UUID clientRequestId) { + return createWithResponseAsync(resourceGroupName, searchServiceName, name, clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryKeyInner create(String resourceGroupName, String searchServiceName, String name) { + final UUID clientRequestId = null; + return createAsync(resourceGroupName, searchServiceName, name, clientRequestId).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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only 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(); + } + + /** + * Returns the list of query API keys for the given Azure Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String searchServiceName, String key, UUID clientRequestId) { + return deleteWithResponseAsync(resourceGroupName, searchServiceName, key, clientRequestId) + .flatMap((Response res) -> 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 Cognitive 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((Response res) -> 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 Cognitive 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; + deleteAsync(resourceGroupName, searchServiceName, key, clientRequestId).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 Cognitive 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(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 Cognitive 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 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 Cognitive 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 000000000000..6800538bf9a7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/QueryKeysImpl.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.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 com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.UUID; + +public final class QueryKeysImpl implements QueryKeys { + @JsonIgnore private 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 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 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 PagedIterable listBySearchService(String resourceGroupName, String searchServiceName) { + PagedIterable inner = + this.serviceClient().listBySearchService(resourceGroupName, searchServiceName); + return Utils.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 Utils.mapPage(inner, inner1 -> new QueryKeyImpl(inner1, this.manager())); + } + + public void delete(String resourceGroupName, String searchServiceName, String key) { + this.serviceClient().delete(resourceGroupName, searchServiceName, key); + } + + public Response deleteWithResponse( + String resourceGroupName, String searchServiceName, String key, UUID clientRequestId, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, searchServiceName, key, clientRequestId, context); + } + + 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/SearchManagementClientBuilder.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientBuilder.java new file mode 100644 index 000000000000..f29f04fe5e17 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientBuilder.java @@ -0,0 +1,148 @@ +// 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.CookiePolicy; +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 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 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 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() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + SearchManagementClientImpl client = + new SearchManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + 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 000000000000..9d02df9d47dd --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchManagementClientImpl.java @@ -0,0 +1,382 @@ +// 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.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.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +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.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.SearchManagementClient; +import com.azure.resourcemanager.search.fluent.ServicesClient; +import com.azure.resourcemanager.search.fluent.SharedPrivateLinkResourcesClient; +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 java.util.Map; +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 { + private final ClientLogger logger = new ClientLogger(SearchManagementClientImpl.class); + + /** + * 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; + } + + /** + * 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 = "2020-08-01"; + 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); + } + + /** + * 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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return 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(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)); + } + } +} 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 000000000000..48624c073d47 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SearchServiceImpl.java @@ -0,0 +1,346 @@ +// 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.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.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 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 Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.searchServiceName = Utils.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 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 000000000000..898f733eff34 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesClientImpl.java @@ -0,0 +1,1981 @@ +// 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(ServicesClientImpl.class); + + /** 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") + private 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 SyncPoller} for polling of describes an Azure Cognitive Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SearchServiceInner> beginCreateOrUpdate( + String resourceGroupName, String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId) { + return 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 Cognitive 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 Cognitive 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 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchServiceInner createOrUpdate( + String resourceGroupName, String searchServiceName, SearchServiceInner serviceParam, UUID clientRequestId) { + 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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, UUID clientRequestId) { + return updateWithResponseAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive 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 Cognitive 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive 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 Cognitive Search service and its current state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SearchServiceInner update( + String resourceGroupName, String searchServiceName, SearchServiceUpdate serviceParam) { + final UUID clientRequestId = null; + return updateAsync(resourceGroupName, searchServiceName, serviceParam, clientRequestId).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 Cognitive 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 Cognitive 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(); + } + + /** + * 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 Cognitive 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 Cognitive 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 Cognitive 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 on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String searchServiceName, UUID clientRequestId) { + return getByResourceGroupWithResponseAsync(resourceGroupName, searchServiceName, clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive 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 getByResourceGroupAsync(resourceGroupName, searchServiceName, clientRequestId).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 Cognitive 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(); + } + + /** + * 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 Cognitive 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 Cognitive 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 Cognitive 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String searchServiceName, UUID clientRequestId) { + return deleteWithResponseAsync(resourceGroupName, searchServiceName, clientRequestId) + .flatMap((Response res) -> 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 Cognitive 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((Response res) -> 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 Cognitive 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; + deleteAsync(resourceGroupName, searchServiceName, clientRequestId).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 Cognitive 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(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + CheckNameAvailabilityInput checkNameAvailabilityInput, UUID clientRequestId) { + return checkNameAvailabilityWithResponseAsync(checkNameAvailabilityInput, clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 checkNameAvailabilityAsync(checkNameAvailabilityInput, clientRequestId).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. + * @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(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 Cognitive 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 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 Cognitive 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 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 Cognitive 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 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 Cognitive 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 000000000000..9fea893b0623 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/ServicesImpl.java @@ -0,0 +1,212 @@ +// 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 com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.UUID; + +public final class ServicesImpl implements Services { + @JsonIgnore private 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 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 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 void delete(String resourceGroupName, String searchServiceName) { + this.serviceClient().delete(resourceGroupName, searchServiceName); + } + + public Response deleteWithResponse( + String resourceGroupName, String searchServiceName, UUID clientRequestId, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, searchServiceName, clientRequestId, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.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 Utils.mapPage(inner, inner1 -> new SearchServiceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SearchServiceImpl(inner1, this.manager())); + } + + public PagedIterable list(UUID clientRequestId, Context context) { + PagedIterable inner = this.serviceClient().list(clientRequestId, context); + return Utils.mapPage(inner, inner1 -> new SearchServiceImpl(inner1, this.manager())); + } + + public CheckNameAvailabilityOutput checkNameAvailability(CheckNameAvailabilityInput checkNameAvailabilityInput) { + CheckNameAvailabilityOutputInner inner = this.serviceClient().checkNameAvailability(checkNameAvailabilityInput); + if (inner != null) { + return new CheckNameAvailabilityOutputImpl(inner, this.manager()); + } else { + return null; + } + } + + 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 SearchService getById(String id) { + String resourceGroupName = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 000000000000..ef825d2e6bde --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourceImpl.java @@ -0,0 +1,186 @@ +// 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 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.searchServiceName = Utils.getValueFromIdByName(innerObject.id(), "searchServices"); + this.sharedPrivateLinkResourceName = Utils.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 000000000000..de276dfef496 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesClientImpl.java @@ -0,0 +1,1655 @@ +// 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(SharedPrivateLinkResourcesClientImpl.class); + + /** 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") + private 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 + * Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 + * Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 SyncPoller} for polling of describes a Shared Private Link Resource managed by the Azure + * Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SharedPrivateLinkResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String searchServiceName, + String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId) { + return 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 + * Cognitive 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 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedPrivateLinkResourceInner createOrUpdate( + String resourceGroupName, + String searchServiceName, + String sharedPrivateLinkResourceName, + SharedPrivateLinkResourceInner sharedPrivateLinkResource, + UUID clientRequestId) { + 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String searchServiceName, + String sharedPrivateLinkResourceName, + UUID clientRequestId) { + return getWithResponseAsync( + resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 getAsync(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId).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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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(); + } + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 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) { + return 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String searchServiceName, + String sharedPrivateLinkResourceName, + UUID clientRequestId) { + 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 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 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 000000000000..66eb67b24330 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/SharedPrivateLinkResourcesImpl.java @@ -0,0 +1,247 @@ +// 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 com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.UUID; + +public final class SharedPrivateLinkResourcesImpl implements SharedPrivateLinkResources { + @JsonIgnore private 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 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 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 void delete( + String resourceGroupName, + String searchServiceName, + String sharedPrivateLinkResourceName, + UUID clientRequestId) { + this + .serviceClient() + .delete(resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, clientRequestId); + } + + 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 Utils.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 Utils.mapPage(inner, inner1 -> new SharedPrivateLinkResourceImpl(inner1, this.manager())); + } + + public SharedPrivateLinkResource getById(String id) { + String resourceGroupName = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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/Utils.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/Utils.java new file mode 100644 index 000000000000..d3e8271c93e0 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/implementation/Utils.java @@ -0,0 +1,204 @@ +// 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 Utils { + 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.size() > 0 && 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, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + 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/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 000000000000..f92b06cfc0c2 --- /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 Cognitive + * 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/AdminKeyKind.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyKind.java new file mode 100644 index 000000000000..46b628a733e3 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyKind.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.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) { + AdminKeyKind[] items = AdminKeyKind.values(); + for (AdminKeyKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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 000000000000..a15e0c0c2cec --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeyResult.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.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 000000000000..e30b3ca951e7 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/AdminKeys.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.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 Cognitive 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 Cognitive 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 Cognitive Search service. + */ + AdminKeyResult get(String resourceGroupName, String searchServiceName); + + /** + * Gets the primary and secondary admin API keys for the specified Azure Cognitive 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 Cognitive 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 Cognitive Search service along with + * {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String searchServiceName, 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 Cognitive 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 Cognitive Search service. + */ + AdminKeyResult regenerate(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind); + + /** + * 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 Cognitive 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 Cognitive Search service + * along with {@link Response}. + */ + Response regenerateWithResponse( + String resourceGroupName, + String searchServiceName, + AdminKeyKind keyKind, + UUID clientRequestId, + Context context); +} 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 000000000000..1f887b085553 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityInput.java @@ -0,0 +1,96 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Input of check name availability API. */ +@Fluent +public final class CheckNameAvailabilityInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityInput.class); + + /* + * 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() { + type = "searchServices"; + } + + /** + * 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 + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model CheckNameAvailabilityInput")); + } + } +} 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 000000000000..b0c303e2270f --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/CheckNameAvailabilityOutput.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.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/HostingMode.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/HostingMode.java new file mode 100644 index 000000000000..93b6043d365d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/HostingMode.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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for HostingMode. */ +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) { + HostingMode[] items = HostingMode.values(); + for (HostingMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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 000000000000..754252bcd2ad --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Identity.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Identity for the resource. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The identity type. + */ + @JsonProperty(value = "type", required = true) + private IdentityType type; + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property type in model Identity")); + } + } +} 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 000000000000..6a350be7cf67 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IdentityType.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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IdentityType. */ +public enum IdentityType { + /** Enum value None. */ + NONE("None"), + + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"); + + /** The actual serialized value for a IdentityType instance. */ + private final String value; + + IdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed IdentityType object, or null if unable to parse. + */ + @JsonCreator + public static IdentityType fromString(String value) { + IdentityType[] items = IdentityType.values(); + for (IdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} 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 000000000000..3be96af65375 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/IpRule.java @@ -0,0 +1,53 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The IP restriction rule of the Azure Cognitive Search service. */ +@Fluent +public final class IpRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IpRule.class); + + /* + * 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; + + /** + * 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 000000000000..31234fab1bd2 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ListQueryKeysResult.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.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.models.QueryKeyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response containing the query API keys for a given Azure Cognitive Search service. */ +@Immutable +public final class ListQueryKeysResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListQueryKeysResult.class); + + /* + * The query keys for the Azure Cognitive 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; + + /** + * Get the value property: The query keys for the Azure Cognitive 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 000000000000..6a43c2073983 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/NetworkRuleSet.java @@ -0,0 +1,68 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Network specific rules that determine how the Azure Cognitive Search service may be reached. */ +@Fluent +public final class NetworkRuleSet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkRuleSet.class); + + /* + * 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; + + /** + * 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; + } + + /** + * 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/Operation.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operation.java new file mode 100644 index 000000000000..89cf0745733f --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operation.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.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 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/OperationDisplay.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationDisplay.java new file mode 100644 index 000000000000..13909e4c0a6d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationDisplay.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that describes the operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * 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; + + /** + * 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 000000000000..f43ab839cb76 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/OperationListResult.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.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * The list of operations supported by the resource provider. + */ + @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; + + /** + * Get the value property: The list of operations supported by the resource provider. + * + * @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/Operations.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operations.java new file mode 100644 index 000000000000..547fbb4bc265 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Operations.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.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 000000000000..a6a5dff7e376 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnection.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.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 + * Cognitive 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 000000000000..ae8f71e360cc --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionListResult.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.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response containing a list of Private Endpoint connections. */ +@Immutable +public final class PrivateEndpointConnectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResult.class); + + /* + * 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; + + /** + * 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 000000000000..1e10a6b9fdad --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,87 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of an existing Private Endpoint connection to the Azure Cognitive Search service. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /* + * The private endpoint resource from Microsoft.Network provider. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointConnectionPropertiesPrivateEndpoint privateEndpoint; + + /* + * Describes the current state of an existing Private Link Service + * connection to the Azure Private Endpoint. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /** + * 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 Private Link + * Service connection to the Azure Private Endpoint. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Describes the current state of an existing Private Link + * Service connection to the Azure Private Endpoint. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + 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 000000000000..19649f7706d8 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateEndpoint.java @@ -0,0 +1,52 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private endpoint resource from Microsoft.Network provider. */ +@Fluent +public final class PrivateEndpointConnectionPropertiesPrivateEndpoint { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionPropertiesPrivateEndpoint.class); + + /* + * The resource id of the private endpoint resource from Microsoft.Network + * provider. + */ + @JsonProperty(value = "id") + private String id; + + /** + * 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 000000000000..aa7ec8092f19 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState.java @@ -0,0 +1,109 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the current state of an existing Private Link Service connection to the Azure Private Endpoint. */ +@Fluent +public final class PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState.class); + + /* + * Status of the the private link service connection. Can be 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; + + /** + * Get the status property: Status of the the private link service connection. Can be 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. Can be 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 000000000000..bed281b9febc --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateEndpointConnections.java @@ -0,0 +1,180 @@ +// 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service. + */ + PrivateEndpointConnection update( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service along with {@link + * Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner privateEndpointConnection, + 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service. + */ + PrivateEndpointConnection delete( + 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 Cognitive Search service associated with the specified resource + * group. + * @param privateEndpointConnectionName The name of the private endpoint connection to the Azure Cognitive 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 Cognitive Search service along with {@link + * Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String searchServiceName, + String privateEndpointConnectionName, + UUID clientRequestId, + Context 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 Cognitive 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 Cognitive 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 000000000000..d99bfc545e53 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResource.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.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 + * Cognitive 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 000000000000..e64dde14b154 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourceProperties.java @@ -0,0 +1,93 @@ +// 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.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Describes the properties of a supported private link resource for the Azure Cognitive Search service. For a given API + * version, this represents the 'supported' groupIds when creating a shared private link resource. + */ +@Immutable +public final class PrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceProperties.class); + + /* + * 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 Cognitive Search. + */ + @JsonProperty(value = "shareablePrivateLinkResourceTypes", access = JsonProperty.Access.WRITE_ONLY) + private List shareablePrivateLinkResourceTypes; + + /** + * 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 Cognitive 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 000000000000..309782a27f31 --- /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 Cognitive 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 Cognitive 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 000000000000..62cc83b28df4 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkResourcesResult.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response containing a list of supported Private Link Resources. */ +@Immutable +public final class PrivateLinkResourcesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesResult.class); + + /* + * The list of supported Private Link Resources. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * 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/PrivateLinkServiceConnectionStatus.java b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkServiceConnectionStatus.java new file mode 100644 index 000000000000..388ebb0682d0 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PrivateLinkServiceConnectionStatus.java @@ -0,0 +1,53 @@ +// 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 PrivateLinkServiceConnectionStatus. */ +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) { + PrivateLinkServiceConnectionStatus[] items = PrivateLinkServiceConnectionStatus.values(); + for (PrivateLinkServiceConnectionStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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 000000000000..e933145d53e0 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ProvisioningState.java @@ -0,0 +1,50 @@ +// 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 ProvisioningState. */ +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) { + ProvisioningState[] items = ProvisioningState.values(); + for (ProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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 000000000000..69b4d0dbfa19 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/PublicNetworkAccess.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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PublicNetworkAccess. */ +public enum PublicNetworkAccess { + /** Enum value enabled. */ + ENABLED("enabled"), + + /** Enum value disabled. */ + DISABLED("disabled"); + + /** The actual serialized value for a PublicNetworkAccess instance. */ + private final String value; + + PublicNetworkAccess(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PublicNetworkAccess instance. + * + * @param value the serialized value to parse. + * @return the parsed PublicNetworkAccess object, or null if unable to parse. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String value) { + PublicNetworkAccess[] items = PublicNetworkAccess.values(); + for (PublicNetworkAccess item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} 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 000000000000..f7b4b392c25a --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKey.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.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; may be empty. + * + * @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 000000000000..fe4990aa860c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/QueryKeys.java @@ -0,0 +1,118 @@ +// 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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only. + */ + QueryKey create(String resourceGroupName, String searchServiceName, String name); + + /** + * 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 Cognitive 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 Cognitive Search service that has permissions for query operations + * only along with {@link Response}. + */ + Response createWithResponse( + String resourceGroupName, String searchServiceName, String name, UUID clientRequestId, Context context); + + /** + * Returns the list of query API keys for the given Azure Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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 Cognitive 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); + + /** + * 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 Cognitive 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); +} 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 000000000000..347109c17ecd --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchService.java @@ -0,0 +1,527 @@ +// 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. If your service is in the degraded, disabled, or error states, it means the Azure Cognitive 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 Cognitive Search service + * may be reached. + * + * @return the networkRuleSet value. + */ + NetworkRuleSet networkRuleSet(); + + /** + * Gets the privateEndpointConnections property: The list of private endpoint connections to the Azure Cognitive + * Search service. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the sharedPrivateLinkResources property: The list of shared private link resources managed by the Azure + * Cognitive Search service. + * + * @return the sharedPrivateLinkResources value. + */ + List sharedPrivateLinkResources(); + + /** + * 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 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.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 Cognitive + * Search service may be reached.. + * + * @param networkRuleSet Network specific rules that determine how the Azure Cognitive Search service may be + * reached. + * @return the next definition stage. + */ + WithCreate withNetworkRuleSet(NetworkRuleSet networkRuleSet); + } + /** 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.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: The identity of the resource.. + * + * @param identity The identity of the resource. + * @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 Cognitive + * Search service may be reached.. + * + * @param networkRuleSet Network specific rules that determine how the Azure Cognitive Search service may be + * reached. + * @return the next definition stage. + */ + Update withNetworkRuleSet(NetworkRuleSet networkRuleSet); + } + /** 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 000000000000..fefdb2be8861 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceListResult.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.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.models.SearchServiceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response containing a list of Azure Cognitive Search services. */ +@Immutable +public final class SearchServiceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SearchServiceListResult.class); + + /* + * 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; + + /** + * 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 000000000000..d0b9606f4244 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceStatus.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SearchServiceStatus. */ +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"); + + /** 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) { + SearchServiceStatus[] items = SearchServiceStatus.values(); + for (SearchServiceStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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 000000000000..2027e6a10c1e --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SearchServiceUpdate.java @@ -0,0 +1,364 @@ +// 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.core.util.logging.ClientLogger; +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.JsonIgnore; +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 Cognitive Search service. */ +@Fluent +public final class SearchServiceUpdate extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SearchServiceUpdate.class); + + /* + * 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; + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * 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: 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 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. If your service is in the degraded, disabled, or error states, it means the Azure Cognitive 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 Cognitive 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 Cognitive 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 privateEndpointConnections property: The list of private endpoint connections to the Azure Cognitive + * 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 + * Cognitive Search service. + * + * @return the sharedPrivateLinkResources value. + */ + public List sharedPrivateLinkResources() { + return this.innerProperties() == null ? null : this.innerProperties().sharedPrivateLinkResources(); + } + + /** + * 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 000000000000..866dc6941f3f --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Services.java @@ -0,0 +1,212 @@ +// 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 Cognitive 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); + + /** + * 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 Cognitive 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); + + /** + * 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 Cognitive 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); + + /** + * 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 Cognitive 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); + + /** + * 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. + * @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); + + /** + * 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); + + /** + * 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 000000000000..9401c39b05bd --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceProperties.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.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the properties of a resource type that has been onboarded to private link service, supported by Azure + * Cognitive Search. + */ +@Immutable +public final class ShareablePrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ShareablePrivateLinkResourceProperties.class); + + /* + * The resource provider type for the resource that has been onboarded to + * private link service, supported by Azure Cognitive 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 Cognitive 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 Cognitive Search. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the type property: The resource provider type for the resource that has been onboarded to private link + * service, supported by Azure Cognitive 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 Cognitive 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 Cognitive 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 000000000000..719688ad5fc9 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/ShareablePrivateLinkResourceType.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.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an resource type that has been onboarded to private link service, supported by Azure Cognitive Search. */ +@Immutable +public final class ShareablePrivateLinkResourceType { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ShareablePrivateLinkResourceType.class); + + /* + * The name of the resource type that has been onboarded to private link + * service, supported by Azure Cognitive 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 Cognitive Search. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private ShareablePrivateLinkResourceProperties properties; + + /** + * Get the name property: The name of the resource type that has been onboarded to private link service, supported + * by Azure Cognitive 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 Cognitive 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 000000000000..92abed46f76b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResource.java @@ -0,0 +1,181 @@ +// 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 + * Cognitive Search service. + * + * @return the properties value. + */ + SharedPrivateLinkResourceProperties properties(); + + /** + * 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 Cognitive 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 Cognitive Search service.. + * + * @param properties Describes the properties of a Shared Private Link Resource managed by the Azure + * Cognitive 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 Cognitive Search service.. + * + * @param properties Describes the properties of a Shared Private Link Resource managed by the Azure + * Cognitive 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 000000000000..b8c9fcab7e9d --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceListResult.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.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.search.fluent.models.SharedPrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response containing a list of Shared Private Link Resources. */ +@Fluent +public final class SharedPrivateLinkResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedPrivateLinkResourceListResult.class); + + /* + * 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; + + /** + * 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 000000000000..829698f9bf38 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProperties.java @@ -0,0 +1,198 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the properties of an existing Shared Private Link Resource managed by the Azure Cognitive Search service. + */ +@Fluent +public final class SharedPrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedPrivateLinkResourceProperties.class); + + /* + * 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 request 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 to which a shared private link is to be 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. Can be Pending, Approved, + * Rejected or Disconnected. + */ + @JsonProperty(value = "status") + private SharedPrivateLinkResourceStatus status; + + /* + * The provisioning state of the shared private link resource. Can be + * Updating, Deleting, Failed, Succeeded or Incomplete. + */ + @JsonProperty(value = "provisioningState") + private SharedPrivateLinkResourceProvisioningState provisioningState; + + /** + * 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 request 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 request 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 to which a shared private link is to be 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 to which a shared private link is to be 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. Can be 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. Can be 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. Can be 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. Can be 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 000000000000..4544660954f8 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceProvisioningState.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SharedPrivateLinkResourceProvisioningState. */ +public enum SharedPrivateLinkResourceProvisioningState { + /** Enum value Updating. */ + UPDATING("Updating"), + + /** Enum value Deleting. */ + DELETING("Deleting"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Incomplete. */ + INCOMPLETE("Incomplete"); + + /** The actual serialized value for a SharedPrivateLinkResourceProvisioningState instance. */ + private final String value; + + SharedPrivateLinkResourceProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SharedPrivateLinkResourceProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed SharedPrivateLinkResourceProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static SharedPrivateLinkResourceProvisioningState fromString(String value) { + SharedPrivateLinkResourceProvisioningState[] items = SharedPrivateLinkResourceProvisioningState.values(); + for (SharedPrivateLinkResourceProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} 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 000000000000..505576e2c8b6 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResourceStatus.java @@ -0,0 +1,53 @@ +// 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 SharedPrivateLinkResourceStatus. */ +public enum SharedPrivateLinkResourceStatus { + /** 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 SharedPrivateLinkResourceStatus instance. */ + private final String value; + + SharedPrivateLinkResourceStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SharedPrivateLinkResourceStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed SharedPrivateLinkResourceStatus object, or null if unable to parse. + */ + @JsonCreator + public static SharedPrivateLinkResourceStatus fromString(String value) { + SharedPrivateLinkResourceStatus[] items = SharedPrivateLinkResourceStatus.values(); + for (SharedPrivateLinkResourceStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} 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 000000000000..361712cf9000 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SharedPrivateLinkResources.java @@ -0,0 +1,204 @@ +// 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 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); + + /** + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive Search service associated with the specified resource + * group. + * @param sharedPrivateLinkResourceName The name of the shared private link resource managed by the Azure Cognitive + * 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 Cognitive 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 Cognitive 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 000000000000..e3fe325eaa0e --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/Sku.java @@ -0,0 +1,68 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity limits. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * 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; + + /** + * 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 000000000000..b673a7356c12 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/SkuName.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; + +/** Defines values for SkuName. */ +public enum SkuName { + /** Enum value free. */ + FREE("free"), + + /** Enum value basic. */ + BASIC("basic"), + + /** Enum value standard. */ + STANDARD("standard"), + + /** Enum value standard2. */ + STANDARD2("standard2"), + + /** Enum value standard3. */ + STANDARD3("standard3"), + + /** Enum value storage_optimized_l1. */ + STORAGE_OPTIMIZED_L1("storage_optimized_l1"), + + /** Enum value storage_optimized_l2. */ + STORAGE_OPTIMIZED_L2("storage_optimized_l2"); + + /** The actual serialized value for a SkuName instance. */ + private final String value; + + SkuName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuName instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuName object, or null if unable to parse. + */ + @JsonCreator + public static SkuName fromString(String value) { + SkuName[] items = SkuName.values(); + for (SkuName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} 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 000000000000..b2e33161f09c --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/com/azure/resourcemanager/search/models/UnavailableNameReason.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.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UnavailableNameReason. */ +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 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); + } + + /** @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/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 000000000000..61b5ceaec11e --- /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 Cognitive + * 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 000000000000..eaa165ec6a1b --- /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 Cognitive 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 000000000000..063f2aacf986 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// 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; +} 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 000000000000..97e7158d743c --- /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; + +import com.azure.core.util.Context; + +/** Samples for AdminKeys Get. */ +public final class AdminKeysGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..d40639bb4275 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/AdminKeysRegenerateSamples.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; + +import com.azure.core.util.Context; +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/stable/2020-08-01/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, 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 000000000000..b45df57c5155 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsDeleteSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..b41437bc555e --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsGetSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..2e063ac11584 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsListByServiceSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByService. */ +public final class PrivateEndpointConnectionsListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..71300b2c60b8 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/PrivateEndpointConnectionsUpdateSamples.java @@ -0,0 +1,40 @@ +// 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.core.util.Context; +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/stable/2020-08-01/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, + 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 000000000000..6d71b81877c5 --- /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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListSupported. */ +public final class PrivateLinkResourcesListSupportedSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..88da14cad233 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysCreateSamples.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; + +import com.azure.core.util.Context; + +/** Samples for QueryKeys Create. */ +public final class QueryKeysCreateSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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", "Query key for browser-based clients", null, 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 000000000000..6f4da5dde119 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/QueryKeysDeleteSamples.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; + +import com.azure.core.util.Context; + +/** Samples for QueryKeys Delete. */ +public final class QueryKeysDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..fdc699c832b4 --- /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; + +import com.azure.core.util.Context; + +/** Samples for QueryKeys ListBySearchService. */ +public final class QueryKeysListBySearchServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..556c62b5eacf --- /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.core.util.Context; +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/stable/2020-08-01/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, 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 000000000000..7d7b9c05e868 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesCreateOrUpdateSamples.java @@ -0,0 +1,127 @@ +// 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.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.Sku; +import com.azure.resourcemanager.search.models.SkuName; +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/stable/2020-08-01/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/stable/2020-08-01/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/stable/2020-08-01/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)) + .withReplicaCount(3) + .withPartitionCount(1) + .withHostingMode(HostingMode.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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(); + } + + @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 000000000000..1b371cded8d9 --- /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; + +import com.azure.core.util.Context; + +/** Samples for Services Delete. */ +public final class ServicesDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..b6e71876890b --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesGetByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** Samples for Services GetByResourceGroup. */ +public final class ServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..409e44dbe14b --- /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; + +import com.azure.core.util.Context; + +/** Samples for Services ListByResourceGroup. */ +public final class ServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..1dfce2247bf4 --- /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; + +import com.azure.core.util.Context; + +/** Samples for Services List. */ +public final class ServicesListSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..b590a1e49cb1 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/ServicesUpdateSamples.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.generated; + +import com.azure.core.util.Context; +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.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/stable/2020-08-01/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, 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/stable/2020-08-01/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, 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/stable/2020-08-01/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, Context.NONE).getValue(); + resource + .update() + .withReplicaCount(1) + .withPartitionCount(1) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .apply(); + } + + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")) + .withReplicaCount(2) + .apply(); + } + + @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 000000000000..a8d30ca9b805 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// 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/stable/2020-08-01/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 000000000000..5c71f2ad89bb --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesDeleteSamples.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; + +import com.azure.core.util.Context; + +/** Samples for SharedPrivateLinkResources Delete. */ +public final class SharedPrivateLinkResourcesDeleteSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..dae98bde6367 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesGetSamples.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; + +import com.azure.core.util.Context; + +/** Samples for SharedPrivateLinkResources Get. */ +public final class SharedPrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, 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 000000000000..41f70a620c35 --- /dev/null +++ b/sdk/search/azure-resourcemanager-search/src/samples/java/com/azure/resourcemanager/search/generated/SharedPrivateLinkResourcesListByServiceSamples.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; + +import com.azure.core.util.Context; + +/** Samples for SharedPrivateLinkResources ListByService. */ +public final class SharedPrivateLinkResourcesListByServiceSamples { + /* + * x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/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, Context.NONE); + } +} diff --git a/sdk/search/ci.yml b/sdk/search/ci.yml index c13e113d0d4b..5ece534550ca 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: @@ -40,3 +41,6 @@ extends: - name: azure-search-documents groupId: com.azure safeName: azuresearch + - name: azure-resourcemanager-search + groupId: com.azure.resourcemanager + safeName: azureresourcemanagersearch diff --git a/sdk/search/pom.xml b/sdk/search/pom.xml index c54c3dd5c806..5cc490cb5615 100644 --- a/sdk/search/pom.xml +++ b/sdk/search/pom.xml @@ -42,6 +42,7 @@ true + azure-resourcemanager-search azure-search-documents azure-search-perf