From eed0cc8b34c68b71e60e3d750d412e0841946ff3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 4 Jun 2024 21:29:44 +0000 Subject: [PATCH] CodeGen from PR 29330 in Azure/azure-rest-api-specs Merge d3ad97bb7466a42c37207e9d74becd0dad0af933 into 1c0fd99e98a38940e6d1b5220709dd83c900b4ed --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 107 ++ .../SAMPLE.md | 574 ++++++ .../pom.xml | 62 + .../mongocluster/MongoClusterManager.java | 341 ++++ .../fluent/FirewallRulesClient.java | 201 +++ .../fluent/MongoClusterManagementClient.java | 83 + .../fluent/MongoClustersClient.java | 338 ++++ .../mongocluster/fluent/OperationsClient.java | 40 + .../PrivateEndpointConnectionsClient.java | 220 +++ .../fluent/PrivateLinksClient.java | 44 + .../CheckNameAvailabilityResponseInner.java | 107 ++ .../fluent/models/FirewallRuleInner.java | 75 + .../ListConnectionStringsResultInner.java | 48 + .../fluent/models/MongoClusterInner.java | 94 + .../fluent/models/OperationInner.java | 126 ++ ...rivateEndpointConnectionResourceInner.java | 75 + .../models/PrivateLinkResourceInner.java | 75 + .../fluent/models/package-info.java | 10 + .../mongocluster/fluent/package-info.java | 10 + .../CheckNameAvailabilityResponseImpl.java | 41 + .../implementation/FirewallRuleImpl.java | 129 ++ .../FirewallRulesClientImpl.java | 948 ++++++++++ .../implementation/FirewallRulesImpl.java | 159 ++ .../ListConnectionStringsResultImpl.java | 40 + .../implementation/MongoClusterImpl.java | 194 ++ .../MongoClusterManagementClientBuilder.java | 138 ++ .../MongoClusterManagementClientImpl.java | 352 ++++ .../MongoClustersClientImpl.java | 1584 +++++++++++++++++ .../implementation/MongoClustersImpl.java | 194 ++ .../implementation/OperationImpl.java | 51 + .../implementation/OperationsClientImpl.java | 239 +++ .../implementation/OperationsImpl.java | 45 + ...PrivateEndpointConnectionResourceImpl.java | 108 ++ .../PrivateEndpointConnectionsClientImpl.java | 1003 +++++++++++ .../PrivateEndpointConnectionsImpl.java | 170 ++ .../PrivateLinkResourceImpl.java | 50 + .../PrivateLinksClientImpl.java | 290 +++ .../implementation/PrivateLinksImpl.java | 48 + .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/package-info.java | 10 + .../mongocluster/models/ActionType.java | 48 + ...ourceManagerPrivateEndpointConnection.java | 75 + .../models/CheckNameAvailabilityReason.java | 53 + .../models/CheckNameAvailabilityRequest.java | 80 + .../models/CheckNameAvailabilityResponse.java | 40 + .../mongocluster/models/ConnectionString.java | 58 + .../mongocluster/models/CreateMode.java | 53 + .../mongocluster/models/FirewallRule.java | 177 ++ .../models/FirewallRuleListResult.java | 91 + .../models/FirewallRuleProperties.java | 108 ++ .../mongocluster/models/FirewallRules.java | 144 ++ .../models/ListConnectionStringsResult.java | 27 + .../mongocluster/models/MongoCluster.java | 288 +++ .../models/MongoClusterListResult.java | 91 + .../models/MongoClusterProperties.java | 297 ++++ .../models/MongoClusterRestoreParameters.java | 81 + .../models/MongoClusterStatus.java | 78 + .../models/MongoClusterUpdate.java | 86 + .../models/MongoClusterUpdateProperties.java | 164 ++ .../mongocluster/models/MongoClusters.java | 212 +++ .../mongocluster/models/NodeGroupSpec.java | 160 ++ .../mongocluster/models/NodeKind.java | 48 + .../mongocluster/models/Operation.java | 58 + .../mongocluster/models/OperationDisplay.java | 92 + .../models/OperationListResult.java | 64 + .../mongocluster/models/Operations.java | 35 + .../mongocluster/models/Origin.java | 59 + .../mongocluster/models/PrivateEndpoint.java | 43 + .../PrivateEndpointConnectionProperties.java | 127 ++ ...teEndpointConnectionProvisioningState.java | 64 + .../PrivateEndpointConnectionResource.java | 138 ++ ...eEndpointConnectionResourceListResult.java | 92 + .../models/PrivateEndpointConnections.java | 154 ++ ...rivateEndpointServiceConnectionStatus.java | 59 + .../models/PrivateLinkResource.java | 55 + .../models/PrivateLinkResourceListResult.java | 92 + .../models/PrivateLinkResourceProperties.java | 85 + .../PrivateLinkServiceConnectionState.java | 110 ++ .../mongocluster/models/PrivateLinks.java | 39 + .../models/ProvisioningState.java | 73 + .../models/PublicNetworkAccess.java | 54 + .../mongocluster/models/package-info.java | 10 + .../mongocluster/package-info.java | 10 + .../src/main/java/module-info.java | 13 + .../proxy-config.json | 1 + .../reflect-config.json | 181 ++ .../FirewallRulesCreateOrUpdateSamples.java | 30 + .../generated/FirewallRulesDeleteSamples.java | 23 + .../generated/FirewallRulesGetSamples.java | 24 + ...irewallRulesListByMongoClusterSamples.java | 23 + ...oClustersCheckNameAvailabilitySamples.java | 44 + .../MongoClustersCreateOrUpdateSamples.java | 65 + .../generated/MongoClustersDeleteSamples.java | 23 + ...ongoClustersGetByResourceGroupSamples.java | 23 + ...ngoClustersListByResourceGroupSamples.java | 23 + ...oClustersListConnectionStringsSamples.java | 24 + .../generated/MongoClustersListSamples.java | 23 + .../generated/MongoClustersUpdateSamples.java | 80 + .../generated/OperationsListSamples.java | 22 + ...ivateEndpointConnectionsCreateSamples.java | 33 + ...ivateEndpointConnectionsDeleteSamples.java | 25 + .../PrivateEndpointConnectionsGetSamples.java | 25 + ...tConnectionsListByMongoClusterSamples.java | 24 + ...PrivateLinksListByMongoClusterSamples.java | 23 + sdk/mongocluster/ci.yml | 47 + sdk/mongocluster/pom.xml | 15 + 109 files changed, 13411 insertions(+) create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/README.md create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/SAMPLE.md create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/MongoClusterManager.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/FirewallRulesClient.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClusterManagementClient.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClustersClient.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/OperationsClient.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateEndpointConnectionsClient.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateLinksClient.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/CheckNameAvailabilityResponseInner.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/FirewallRuleInner.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ListConnectionStringsResultInner.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/MongoClusterInner.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/OperationInner.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateEndpointConnectionResourceInner.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateLinkResourceInner.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/package-info.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/package-info.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRuleImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesClientImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ListConnectionStringsResultImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientBuilder.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersClientImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsClientImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionResourceImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinkResourceImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksClientImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksImpl.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ResourceManagerUtils.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/package-info.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ActionType.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/AzureResourceManagerPrivateEndpointConnection.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityReason.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityRequest.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityResponse.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CreateMode.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRule.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleListResult.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleProperties.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRules.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ListConnectionStringsResult.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoCluster.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterListResult.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterProperties.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterRestoreParameters.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdate.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdateProperties.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusters.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operation.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationDisplay.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationListResult.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operations.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Origin.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpoint.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProperties.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProvisioningState.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResource.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResourceListResult.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnections.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointServiceConnectionStatus.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResource.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceListResult.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceProperties.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkServiceConnectionState.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinks.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ProvisioningState.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PublicNetworkAccess.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/package-info.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/package-info.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/module-info.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/proxy-config.json create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/reflect-config.json create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesDeleteSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilitySamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCreateOrUpdateSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersGetByResourceGroupSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListByResourceGroupSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersUpdateSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsDeleteSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java create mode 100644 sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterSamples.java create mode 100644 sdk/mongocluster/ci.yml create mode 100644 sdk/mongocluster/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 3dbde3b4a2509..d12f6971f7456 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -464,6 +464,7 @@ com.azure.resourcemanager:azure-resourcemanager-edgezones;1.0.0-beta.1;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-devopsinfrastructure;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-oracledatabase;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-informaticadatamanagement;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-mongocluster;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index b83a3963b563e..5090732934e20 100644 --- a/pom.xml +++ b/pom.xml @@ -137,6 +137,7 @@ sdk/mixedreality sdk/mobilenetwork sdk/modelsrepository + sdk/mongocluster sdk/monitor sdk/mysql sdk/mysqlflexibleserver diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md b/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md new file mode 100644 index 0000000000000..a6065b7b3e457 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2024-06-04) + +- Azure Resource Manager Mongo Cluster client library for Java. This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules. Package tag package-2024-03-01-preview. 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/mongocluster/azure-resourcemanager-mongocluster/README.md b/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md new file mode 100644 index 0000000000000..9bd6b9f8c2b5b --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md @@ -0,0 +1,107 @@ +# Azure Resource Manager Mongo Cluster client library for Java + +Azure Resource Manager Mongo Cluster client library for Java. + +This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules. Package tag package-2024-03-01-preview. 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-mongocluster;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-mongocluster + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +MongoClusterManager manager = MongoClusterManager + .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/mongocluster/azure-resourcemanager-mongocluster/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fmongocluster%2Fazure-resourcemanager-mongocluster%2FREADME.png) diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/SAMPLE.md b/sdk/mongocluster/azure-resourcemanager-mongocluster/SAMPLE.md new file mode 100644 index 0000000000000..04b60b9cc7028 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/SAMPLE.md @@ -0,0 +1,574 @@ +# Code snippets and samples + + +## FirewallRules + +- [CreateOrUpdate](#firewallrules_createorupdate) +- [Delete](#firewallrules_delete) +- [Get](#firewallrules_get) +- [ListByMongoCluster](#firewallrules_listbymongocluster) + +## MongoClusters + +- [CheckNameAvailability](#mongoclusters_checknameavailability) +- [CreateOrUpdate](#mongoclusters_createorupdate) +- [Delete](#mongoclusters_delete) +- [GetByResourceGroup](#mongoclusters_getbyresourcegroup) +- [List](#mongoclusters_list) +- [ListByResourceGroup](#mongoclusters_listbyresourcegroup) +- [ListConnectionStrings](#mongoclusters_listconnectionstrings) +- [Update](#mongoclusters_update) + +## Operations + +- [List](#operations_list) + +## PrivateEndpointConnections + +- [Create](#privateendpointconnections_create) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByMongoCluster](#privateendpointconnections_listbymongocluster) + +## PrivateLinks + +- [ListByMongoCluster](#privatelinks_listbymongocluster) +### FirewallRules_CreateOrUpdate + +```java +import com.azure.resourcemanager.mongocluster.models.FirewallRuleProperties; + +/** + * Samples for FirewallRules CreateOrUpdate. + */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json + */ + /** + * Sample code: Creates a firewall rule on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void createsAFirewallRuleOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.firewallRules() + .define("rule1") + .withExistingMongoCluster("TestGroup", "myMongoCluster") + .withProperties( + new FirewallRuleProperties().withStartIpAddress("0.0.0.0").withEndIpAddress("255.255.255.255")) + .create(); + } +} +``` + +### FirewallRules_Delete + +```java +/** + * Samples for FirewallRules Delete. + */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json + */ + /** + * Sample code: Deletes a firewall rule on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void deletesAFirewallRuleOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.firewallRules().delete("TestGroup", "myMongoCluster", "rule1", com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_Get + +```java +/** + * Samples for FirewallRules Get. + */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json + */ + /** + * Sample code: Gets a firewall rule on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + getsAFirewallRuleOnAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.firewallRules() + .getWithResponse("TestGroup", "myMongoCluster", "rule1", com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_ListByMongoCluster + +```java +/** + * Samples for FirewallRules ListByMongoCluster. + */ +public final class FirewallRulesListByMongoClusterSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json + */ + /** + * Sample code: List the firewall rules on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listTheFirewallRulesOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.firewallRules().listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_CheckNameAvailability + +```java +import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; + +/** + * Samples for MongoClusters CheckNameAvailability. + */ +public final class MongoClustersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability.json + */ + /** + * Sample code: Checks and confirms the Mongo Cluster name is availability for use. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .checkNameAvailabilityWithResponse("westus2", new CheckNameAvailabilityRequest().withName("newmongocluster") + .withType("Microsoft.DocumentDB/mongoClusters"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability_AlreadyExists.json + */ + /** + * Sample code: Checks and returns that the Mongo Cluster name is already in-use. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .checkNameAvailabilityWithResponse("westus2", + new CheckNameAvailabilityRequest().withName("existingmongocluster") + .withType("Microsoft.DocumentDB/mongoClusters"), + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_CreateOrUpdate + +```java +import com.azure.resourcemanager.mongocluster.models.CreateMode; +import com.azure.resourcemanager.mongocluster.models.MongoClusterProperties; +import com.azure.resourcemanager.mongocluster.models.MongoClusterRestoreParameters; +import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; +import com.azure.resourcemanager.mongocluster.models.NodeKind; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for MongoClusters CreateOrUpdate. + */ +public final class MongoClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json + */ + /** + * Sample code: Creates a Mongo Cluster resource from a point in time restore. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void createsAMongoClusterResourceFromAPointInTimeRestore( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .define("myMongoCluster") + .withRegion("westus2") + .withExistingResourceGroup("TestResourceGroup") + .withProperties(new MongoClusterProperties().withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withRestoreParameters(new MongoClusterRestoreParameters() + .withPointInTimeUtc(OffsetDateTime.parse("2023-01-13T20:07:35Z")) + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster"))) + .create(); + } + + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Create.json + */ + /** + * Sample code: Creates a new Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + createsANewMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .define("myMongoCluster") + .withRegion("westus2") + .withExistingResourceGroup("TestResourceGroup") + .withProperties(new MongoClusterProperties().withAdministratorLogin("mongoAdmin") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withServerVersion("5.0") + .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withSku("M30") + .withDiskSizeGB(128L) + .withEnableHa(true) + .withKind(NodeKind.SHARD) + .withNodeCount(1)))) + .create(); + } +} +``` + +### MongoClusters_Delete + +```java +/** + * Samples for MongoClusters Delete. + */ +public final class MongoClustersDeleteSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json + */ + /** + * Sample code: Deletes a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + deletesAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters().delete("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_GetByResourceGroup + +```java +/** + * Samples for MongoClusters GetByResourceGroup. + */ +public final class MongoClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json + */ + /** + * Sample code: Gets a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void getsAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_List + +```java +/** + * Samples for MongoClusters List. + */ +public final class MongoClustersListSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.json + */ + /** + * Sample code: Lists the Mongo Cluster resources in a subscription. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listsTheMongoClusterResourcesInASubscription( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters().list(com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_ListByResourceGroup + +```java +/** + * Samples for MongoClusters ListByResourceGroup. + */ +public final class MongoClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListByResourceGroup.json + */ + /** + * Sample code: Lists the Mongo Cluster resources in a resource group. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listsTheMongoClusterResourcesInAResourceGroup( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters().listByResourceGroup("TestResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_ListConnectionStrings + +```java +/** + * Samples for MongoClusters ListConnectionStrings. + */ +public final class MongoClustersListConnectionStringsSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json + */ + /** + * Sample code: List the available connection strings for the Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listTheAvailableConnectionStringsForTheMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .listConnectionStringsWithResponse("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_Update + +```java +import com.azure.resourcemanager.mongocluster.models.MongoCluster; +import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdateProperties; +import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; +import com.azure.resourcemanager.mongocluster.models.NodeKind; +import com.azure.resourcemanager.mongocluster.models.PublicNetworkAccess; +import java.util.Arrays; + +/** + * Samples for MongoClusters Update. + */ +public final class MongoClustersUpdateSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchDiskSize.json + */ + /** + * Sample code: Updates the disk size on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + updatesTheDiskSizeOnAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties() + .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withDiskSizeGB(256L).withKind(NodeKind.SHARD)))) + .apply(); + } + + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json + */ + /** + * Sample code: Disables public network access on a Mongo Cluster resource with a private endpoint connection. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties().withPublicNetworkAccess(PublicNetworkAccess.DISABLED)) + .apply(); + } + + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Update.json + */ + /** + * Sample code: Updates a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + updatesAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties().withAdministratorLogin("mongoAdmin") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withServerVersion("5.0") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withSku("M50") + .withDiskSizeGB(256L) + .withEnableHa(true) + .withKind(NodeKind.SHARD) + .withNodeCount(1)))) + .apply(); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void operationsList(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Create + +```java +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.mongocluster.models.PrivateLinkServiceConnectionState; + +/** + * Samples for PrivateEndpointConnections Create. + */ +public final class PrivateEndpointConnectionsCreateSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json + */ + /** + * Sample code: Approves a private endpoint connection on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void approvesAPrivateEndpointConnectionOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateEndpointConnections() + .define("pecTest") + .withExistingMongoCluster("TestGroup", "myMongoCluster") + .withProperties(new PrivateEndpointConnectionProperties().withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Auto-Approved"))) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Delete a private endpoint connection on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void deleteAPrivateEndpointConnectionOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateEndpointConnections() + .delete("TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", + com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Get a private endpoint connection on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void getAPrivateEndpointConnectionOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateEndpointConnections() + .getWithResponse("TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", + com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByMongoCluster + +```java +/** + * Samples for PrivateEndpointConnections ListByMongoCluster. + */ +public final class PrivateEndpointConnectionsListByMongoClusterSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json + */ + /** + * Sample code: Lists the private endpoint connection resources on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateEndpointConnections() + .listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinks_ListByMongoCluster + +```java +/** + * Samples for PrivateLinks ListByMongoCluster. + */ +public final class PrivateLinksListByMongoClusterSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json + */ + /** + * Sample code: Lists the private link resources available on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listsThePrivateLinkResourcesAvailableOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateLinks().listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml b/sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml new file mode 100644 index 0000000000000..730e4405548dd --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-mongocluster + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Mongo Cluster Management + This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules. Package tag package-2024-03-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.49.0 + + + com.azure + azure-core-management + 1.14.0 + + + diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/MongoClusterManager.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/MongoClusterManager.java new file mode 100644 index 0000000000000..7f5463635a3e9 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/MongoClusterManager.java @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mongocluster.fluent.MongoClusterManagementClient; +import com.azure.resourcemanager.mongocluster.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.mongocluster.implementation.MongoClusterManagementClientBuilder; +import com.azure.resourcemanager.mongocluster.implementation.MongoClustersImpl; +import com.azure.resourcemanager.mongocluster.implementation.OperationsImpl; +import com.azure.resourcemanager.mongocluster.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.mongocluster.implementation.PrivateLinksImpl; +import com.azure.resourcemanager.mongocluster.models.FirewallRules; +import com.azure.resourcemanager.mongocluster.models.MongoClusters; +import com.azure.resourcemanager.mongocluster.models.Operations; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnections; +import com.azure.resourcemanager.mongocluster.models.PrivateLinks; +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 MongoClusterManager. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for + * MongoDB vCore resources including clusters and firewall rules. + */ +public final class MongoClusterManager { + private Operations operations; + + private MongoClusters mongoClusters; + + private FirewallRules firewallRules; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinks privateLinks; + + private final MongoClusterManagementClient clientObject; + + private MongoClusterManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MongoClusterManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Mongo Cluster service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Mongo Cluster service API instance. + */ + public static MongoClusterManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Mongo Cluster service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Mongo Cluster service API instance. + */ + public static MongoClusterManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MongoClusterManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create MongoClusterManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MongoClusterManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Mongo Cluster service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Mongo Cluster service API instance. + */ + public MongoClusterManager 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.mongocluster") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new MongoClusterManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of MongoClusters. It manages MongoCluster. + * + * @return Resource collection API of MongoClusters. + */ + public MongoClusters mongoClusters() { + if (this.mongoClusters == null) { + this.mongoClusters = new MongoClustersImpl(clientObject.getMongoClusters(), this); + } + return mongoClusters; + } + + /** + * Gets the resource collection API of FirewallRules. It manages FirewallRule. + * + * @return Resource collection API of FirewallRules. + */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); + } + return firewallRules; + } + + /** + * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnectionResource. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections + = new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of PrivateLinks. + * + * @return Resource collection API of PrivateLinks. + */ + public PrivateLinks privateLinks() { + if (this.privateLinks == null) { + this.privateLinks = new PrivateLinksImpl(clientObject.getPrivateLinks(), this); + } + return privateLinks; + } + + /** + * Gets wrapped service client MongoClusterManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client MongoClusterManagementClient. + */ + public MongoClusterManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/FirewallRulesClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/FirewallRulesClient.java new file mode 100644 index 0000000000000..33b3167997ade --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/FirewallRulesClient.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.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.mongocluster.fluent.models.FirewallRuleInner; + +/** + * An instance of this class provides access to all the operations defined in FirewallRulesClient. + */ +public interface FirewallRulesClient { + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a FirewallRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName); + + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a FirewallRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, + Context context); + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 information about a mongo cluster firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String mongoClusterName, + String firewallRuleName, Context context); + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 information about a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner get(String resourceGroupName, String mongoClusterName, String firewallRuleName); + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @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 represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, + String mongoClusterName, String firewallRuleName, FirewallRuleInner resource); + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @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 represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, + String mongoClusterName, String firewallRuleName, FirewallRuleInner resource, Context context); + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @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 represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate(String resourceGroupName, String mongoClusterName, String firewallRuleName, + FirewallRuleInner resource); + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @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 represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate(String resourceGroupName, String mongoClusterName, String firewallRuleName, + FirewallRuleInner resource, Context context); + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, + String firewallRuleName); + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, + String firewallRuleName, Context context); + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, String firewallRuleName); + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, String firewallRuleName, Context context); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClusterManagementClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClusterManagementClient.java new file mode 100644 index 0000000000000..43bfcdacb324f --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClusterManagementClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MongoClusterManagementClient class. + */ +public interface MongoClusterManagementClient { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @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 MongoClustersClient object to access its operations. + * + * @return the MongoClustersClient object. + */ + MongoClustersClient getMongoClusters(); + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + FirewallRulesClient getFirewallRules(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinksClient object to access its operations. + * + * @return the PrivateLinksClient object. + */ + PrivateLinksClient getPrivateLinks(); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClustersClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClustersClient.java new file mode 100644 index 0000000000000..c08d514508dec --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClustersClient.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.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.mongocluster.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mongocluster.fluent.models.ListConnectionStringsResultInner; +import com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner; +import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdate; + +/** + * An instance of this class provides access to all the operations defined in MongoClustersClient. + */ +public interface MongoClustersClient { + /** + * Check if mongo cluster name is available for use. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability 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 check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse(String location, + CheckNameAvailabilityRequest body, Context context); + + /** + * Check if mongo cluster name is available for use. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability 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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkNameAvailability(String location, CheckNameAvailabilityRequest body); + + /** + * List all the mongo clusters in a 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 the response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all the mongo clusters in a given subscription. + * + * @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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets information about a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 information about a mongo cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String mongoClusterName, + Context context); + + /** + * Gets information about a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 information about a mongo cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoClusterInner getByResourceGroup(String resourceGroupName, String mongoClusterName); + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoClusterInner> beginCreateOrUpdate(String resourceGroupName, + String mongoClusterName, MongoClusterInner resource); + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoClusterInner> beginCreateOrUpdate(String resourceGroupName, + String mongoClusterName, MongoClusterInner resource, Context context); + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoClusterInner createOrUpdate(String resourceGroupName, String mongoClusterName, MongoClusterInner resource); + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoClusterInner createOrUpdate(String resourceGroupName, String mongoClusterName, MongoClusterInner resource, + Context context); + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoClusterInner> beginUpdate(String resourceGroupName, + String mongoClusterName, MongoClusterUpdate properties); + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MongoClusterInner> beginUpdate(String resourceGroupName, + String mongoClusterName, MongoClusterUpdate properties, Context context); + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoClusterInner update(String resourceGroupName, String mongoClusterName, MongoClusterUpdate properties); + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MongoClusterInner update(String resourceGroupName, String mongoClusterName, MongoClusterUpdate properties, + Context context); + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName); + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName, Context context); + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName); + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName, Context context); + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 connection strings for the given mongo cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConnectionStringsWithResponse(String resourceGroupName, + String mongoClusterName, Context context); + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 connection strings for the given mongo cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String mongoClusterName); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/OperationsClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/OperationsClient.java new file mode 100644 index 0000000000000..7dfcdbb7fc7fe --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/OperationsClient.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.mongocluster.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.mongocluster.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateEndpointConnectionsClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..bdeeba124dfc0 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.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.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. + */ +public interface PrivateEndpointConnectionsClient { + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByMongoCluster(String resourceGroupName, + String mongoClusterName); + + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByMongoCluster(String resourceGroupName, + String mongoClusterName, Context context); + + /** + * Get a specific private connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 specific private connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, Context context); + + /** + * Get a specific private connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 specific private connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionResourceInner get(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName); + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @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 concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionResourceInner> beginCreate( + String resourceGroupName, String mongoClusterName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner resource); + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @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 concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionResourceInner> beginCreate( + String resourceGroupName, String mongoClusterName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner resource, Context context); + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @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 concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionResourceInner create(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner resource); + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @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 concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionResourceInner create(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner resource, Context context); + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, + String privateEndpointConnectionName); + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, + String privateEndpointConnectionName, Context context); + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, String privateEndpointConnectionName); + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, String privateEndpointConnectionName, + Context context); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateLinksClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateLinksClient.java new file mode 100644 index 0000000000000..08d23b4984e77 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateLinksClient.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.mongocluster.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.mongocluster.fluent.models.PrivateLinkResourceInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinksClient. + */ +public interface PrivateLinksClient { + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName); + + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, + Context context); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..1148b6cf8c8a5 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The check availability result. + */ +@Fluent +public final class CheckNameAvailabilityResponseInner { + /* + * Indicates if the resource name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + @JsonProperty(value = "reason") + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is available. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Creates an instance of CheckNameAvailabilityResponseInner class. + */ + public CheckNameAvailabilityResponseInner() { + } + + /** + * Get the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates if the resource name is available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Set the reason property: The reason why the given name is not available. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withReason(CheckNameAvailabilityReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: Detailed reason why the given name is available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Detailed reason why the given name is available. + * + * @param message the message value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/FirewallRuleInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/FirewallRuleInner.java new file mode 100644 index 0000000000000..4ae8adb189cd6 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/FirewallRuleInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongocluster.models.FirewallRuleProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a mongo cluster firewall rule. + */ +@Fluent +public final class FirewallRuleInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private FirewallRuleProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of FirewallRuleInner class. + */ + public FirewallRuleInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public FirewallRuleProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withProperties(FirewallRuleProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ListConnectionStringsResultInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ListConnectionStringsResultInner.java new file mode 100644 index 0000000000000..38dc03e412df5 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ListConnectionStringsResultInner.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mongocluster.models.ConnectionString; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The connection strings for the given mongo cluster. + */ +@Immutable +public final class ListConnectionStringsResultInner { + /* + * An array that contains the connection strings for a mongo cluster. + */ + @JsonProperty(value = "connectionStrings", access = JsonProperty.Access.WRITE_ONLY) + private List connectionStrings; + + /** + * Creates an instance of ListConnectionStringsResultInner class. + */ + public ListConnectionStringsResultInner() { + } + + /** + * Get the connectionStrings property: An array that contains the connection strings for a mongo cluster. + * + * @return the connectionStrings value. + */ + public List connectionStrings() { + return this.connectionStrings; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectionStrings() != null) { + connectionStrings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/MongoClusterInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/MongoClusterInner.java new file mode 100644 index 0000000000000..d52f91acca121 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/MongoClusterInner.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongocluster.models.MongoClusterProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * Represents a mongo cluster resource. + */ +@Fluent +public final class MongoClusterInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private MongoClusterProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of MongoClusterInner class. + */ + public MongoClusterInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public MongoClusterProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the MongoClusterInner object itself. + */ + public MongoClusterInner withProperties(MongoClusterProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * {@inheritDoc} + */ + @Override + public MongoClusterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MongoClusterInner withTags(Map tags) { + super.withTags(tags); + 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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/OperationInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..f5c0ff341bec8 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/OperationInner.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mongocluster.models.ActionType; +import com.azure.resourcemanager.mongocluster.models.OperationDisplay; +import com.azure.resourcemanager.mongocluster.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateEndpointConnectionResourceInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateEndpointConnectionResourceInner.java new file mode 100644 index 0000000000000..3898a3ae6bcd9 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateEndpointConnectionResourceInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class PrivateEndpointConnectionResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of PrivateEndpointConnectionResourceInner class. + */ + public PrivateEndpointConnectionResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the PrivateEndpointConnectionResourceInner object itself. + */ + public PrivateEndpointConnectionResourceInner withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateLinkResourceInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..46213f68fb790 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongocluster.models.PrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private PrivateLinkResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of PrivateLinkResourceInner class. + */ + public PrivateLinkResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the PrivateLinkResourceInner object itself. + */ + public PrivateLinkResourceInner withProperties(PrivateLinkResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/package-info.java new file mode 100644 index 0000000000000..8119c68b4f314 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// 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 MongoClusterManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for + * MongoDB vCore resources including clusters and firewall rules. + */ +package com.azure.resourcemanager.mongocluster.fluent.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/package-info.java new file mode 100644 index 0000000000000..64a699badc4bc --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/package-info.java @@ -0,0 +1,10 @@ +// 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 MongoClusterManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for + * MongoDB vCore resources including clusters and firewall rules. + */ +package com.azure.resourcemanager.mongocluster.fluent; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..90bcd142f8014 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/CheckNameAvailabilityResponseImpl.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.mongocluster.implementation; + +import com.azure.resourcemanager.mongocluster.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + CheckNameAvailabilityResponseImpl(CheckNameAvailabilityResponseInner innerObject, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRuleImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRuleImpl.java new file mode 100644 index 0000000000000..7bc9503b6a4ec --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRuleImpl.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongocluster.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.mongocluster.models.FirewallRule; +import com.azure.resourcemanager.mongocluster.models.FirewallRuleProperties; + +public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private FirewallRuleInner innerObject; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public FirewallRuleProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String mongoClusterName; + + private String firewallRuleName; + + public FirewallRuleImpl withExistingMongoCluster(String resourceGroupName, String mongoClusterName) { + this.resourceGroupName = resourceGroupName; + this.mongoClusterName = mongoClusterName; + return this; + } + + public FirewallRule create() { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, mongoClusterName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, mongoClusterName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl(String name, com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerObject = new FirewallRuleInner(); + this.serviceManager = serviceManager; + this.firewallRuleName = name; + } + + public FirewallRuleImpl update() { + return this; + } + + public FirewallRule apply() { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, mongoClusterName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, mongoClusterName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl(FirewallRuleInner innerObject, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.mongoClusterName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "mongoClusters"); + this.firewallRuleName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "firewallRules"); + } + + public FirewallRule refresh() { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, mongoClusterName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public FirewallRule refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, mongoClusterName, firewallRuleName, context) + .getValue(); + return this; + } + + public FirewallRuleImpl withProperties(FirewallRuleProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesClientImpl.java new file mode 100644 index 0000000000000..1844c719685ea --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,948 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mongocluster.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mongocluster.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.mongocluster.models.FirewallRuleListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FirewallRulesClient. + */ +public final class FirewallRulesClientImpl implements FirewallRulesClient { + /** + * The proxy service used to perform REST calls. + */ + private final FirewallRulesService service; + + /** + * The service client containing this operation class. + */ + private final MongoClusterManagementClientImpl client; + + /** + * Initializes an instance of FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FirewallRulesClientImpl(MongoClusterManagementClientImpl client) { + this.service + = RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MongoClusterManagementClientFirewallRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MongoClusterManageme") + public interface FirewallRulesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByMongoCluster(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, + @PathParam("firewallRuleName") String firewallRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, + @PathParam("firewallRuleName") String firewallRuleName, + @BodyParam("application/json") FirewallRuleInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, + @PathParam("firewallRuleName") String firewallRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByMongoClusterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a FirewallRule list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMongoClusterSinglePageAsync(String resourceGroupName, + String mongoClusterName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByMongoCluster(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, 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())); + } + + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a FirewallRule list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMongoClusterSinglePageAsync(String resourceGroupName, + String mongoClusterName, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByMongoCluster(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a FirewallRule list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByMongoClusterAsync(String resourceGroupName, String mongoClusterName) { + return new PagedFlux<>(() -> listByMongoClusterSinglePageAsync(resourceGroupName, mongoClusterName), + nextLink -> listByMongoClusterNextSinglePageAsync(nextLink)); + } + + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a FirewallRule list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByMongoClusterAsync(String resourceGroupName, String mongoClusterName, + Context context) { + return new PagedFlux<>(() -> listByMongoClusterSinglePageAsync(resourceGroupName, mongoClusterName, context), + nextLink -> listByMongoClusterNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a FirewallRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName) { + return new PagedIterable<>(listByMongoClusterAsync(resourceGroupName, mongoClusterName)); + } + + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a FirewallRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, + Context context) { + return new PagedIterable<>(listByMongoClusterAsync(resourceGroupName, mongoClusterName, context)); + } + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a mongo cluster firewall rule along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String mongoClusterName, + String firewallRuleName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, firewallRuleName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 information about a mongo cluster firewall rule along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String mongoClusterName, + String firewallRuleName, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, firewallRuleName, accept, context); + } + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a mongo cluster firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String mongoClusterName, + String firewallRuleName) { + return getWithResponseAsync(resourceGroupName, mongoClusterName, firewallRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 information about a mongo cluster firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String mongoClusterName, + String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, mongoClusterName, firewallRuleName, context).block(); + } + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner get(String resourceGroupName, String mongoClusterName, String firewallRuleName) { + return getWithResponse(resourceGroupName, mongoClusterName, firewallRuleName, Context.NONE).getValue(); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a mongo cluster firewall rule along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String mongoClusterName, String firewallRuleName, FirewallRuleInner resource) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, firewallRuleName, resource, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @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 represents a mongo cluster firewall rule along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String mongoClusterName, String firewallRuleName, FirewallRuleInner resource, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, firewallRuleName, resource, accept, + context); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String mongoClusterName, String firewallRuleName, FirewallRuleInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, mongoClusterName, firewallRuleName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FirewallRuleInner.class, FirewallRuleInner.class, this.client.getContext()); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @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 represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String mongoClusterName, String firewallRuleName, FirewallRuleInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, mongoClusterName, firewallRuleName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FirewallRuleInner.class, FirewallRuleInner.class, context); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, + String mongoClusterName, String firewallRuleName, FirewallRuleInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, mongoClusterName, firewallRuleName, resource) + .getSyncPoller(); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @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 represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, + String mongoClusterName, String firewallRuleName, FirewallRuleInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, mongoClusterName, firewallRuleName, resource, context) + .getSyncPoller(); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a mongo cluster firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String mongoClusterName, + String firewallRuleName, FirewallRuleInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, mongoClusterName, firewallRuleName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @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 represents a mongo cluster firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String mongoClusterName, + String firewallRuleName, FirewallRuleInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, mongoClusterName, firewallRuleName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate(String resourceGroupName, String mongoClusterName, String firewallRuleName, + FirewallRuleInner resource) { + return createOrUpdateAsync(resourceGroupName, mongoClusterName, firewallRuleName, resource).block(); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @param resource Resource create parameters. + * @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 represents a mongo cluster firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate(String resourceGroupName, String mongoClusterName, String firewallRuleName, + FirewallRuleInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, mongoClusterName, firewallRuleName, resource, context).block(); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName, + String firewallRuleName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, firewallRuleName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, + String firewallRuleName, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, firewallRuleName, accept, context); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName, + String firewallRuleName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, mongoClusterName, firewallRuleName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, + String firewallRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, mongoClusterName, firewallRuleName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName, + String firewallRuleName) { + return this.beginDeleteAsync(resourceGroupName, mongoClusterName, firewallRuleName).getSyncPoller(); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, + String firewallRuleName, Context context) { + return this.beginDeleteAsync(resourceGroupName, mongoClusterName, firewallRuleName, context).getSyncPoller(); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName, String firewallRuleName) { + return beginDeleteAsync(resourceGroupName, mongoClusterName, firewallRuleName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, String firewallRuleName, + Context context) { + return beginDeleteAsync(resourceGroupName, mongoClusterName, firewallRuleName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 mongoClusterName, String firewallRuleName) { + deleteAsync(resourceGroupName, mongoClusterName, firewallRuleName).block(); + } + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, String firewallRuleName, Context context) { + deleteAsync(resourceGroupName, mongoClusterName, firewallRuleName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FirewallRule list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMongoClusterNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByMongoClusterNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FirewallRule list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMongoClusterNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByMongoClusterNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesImpl.java new file mode 100644 index 0000000000000..bf7429a12ef28 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.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.mongocluster.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mongocluster.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.mongocluster.models.FirewallRule; +import com.azure.resourcemanager.mongocluster.models.FirewallRules; + +public final class FirewallRulesImpl implements FirewallRules { + private static final ClientLogger LOGGER = new ClientLogger(FirewallRulesImpl.class); + + private final FirewallRulesClient innerClient; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + public FirewallRulesImpl(FirewallRulesClient innerClient, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName) { + PagedIterable inner + = this.serviceClient().listByMongoCluster(resourceGroupName, mongoClusterName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, + Context context) { + PagedIterable inner + = this.serviceClient().listByMongoCluster(resourceGroupName, mongoClusterName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String mongoClusterName, + String firewallRuleName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, mongoClusterName, firewallRuleName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FirewallRule get(String resourceGroupName, String mongoClusterName, String firewallRuleName) { + FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, mongoClusterName, firewallRuleName); + if (inner != null) { + return new FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String mongoClusterName, String firewallRuleName) { + this.serviceClient().delete(resourceGroupName, mongoClusterName, firewallRuleName); + } + + public void delete(String resourceGroupName, String mongoClusterName, String firewallRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, mongoClusterName, firewallRuleName, context); + } + + public FirewallRule getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, mongoClusterName, firewallRuleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, mongoClusterName, firewallRuleName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.delete(resourceGroupName, mongoClusterName, firewallRuleName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.delete(resourceGroupName, mongoClusterName, firewallRuleName, context); + } + + private FirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } + + public FirewallRuleImpl define(String name) { + return new FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ListConnectionStringsResultImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ListConnectionStringsResultImpl.java new file mode 100644 index 0000000000000..0539a25b12c4b --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ListConnectionStringsResultImpl.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.mongocluster.implementation; + +import com.azure.resourcemanager.mongocluster.fluent.models.ListConnectionStringsResultInner; +import com.azure.resourcemanager.mongocluster.models.ConnectionString; +import com.azure.resourcemanager.mongocluster.models.ListConnectionStringsResult; +import java.util.Collections; +import java.util.List; + +public final class ListConnectionStringsResultImpl implements ListConnectionStringsResult { + private ListConnectionStringsResultInner innerObject; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + ListConnectionStringsResultImpl(ListConnectionStringsResultInner innerObject, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List connectionStrings() { + List inner = this.innerModel().connectionStrings(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ListConnectionStringsResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterImpl.java new file mode 100644 index 0000000000000..15648d04a2b7d --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner; +import com.azure.resourcemanager.mongocluster.models.ListConnectionStringsResult; +import com.azure.resourcemanager.mongocluster.models.MongoCluster; +import com.azure.resourcemanager.mongocluster.models.MongoClusterProperties; +import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdate; +import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdateProperties; +import java.util.Collections; +import java.util.Map; + +public final class MongoClusterImpl implements MongoCluster, MongoCluster.Definition, MongoCluster.Update { + private MongoClusterInner innerObject; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager 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 MongoClusterProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MongoClusterInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String mongoClusterName; + + private MongoClusterUpdate updateProperties; + + public MongoClusterImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public MongoCluster create() { + this.innerObject = serviceManager.serviceClient() + .getMongoClusters() + .createOrUpdate(resourceGroupName, mongoClusterName, this.innerModel(), Context.NONE); + return this; + } + + public MongoCluster create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMongoClusters() + .createOrUpdate(resourceGroupName, mongoClusterName, this.innerModel(), context); + return this; + } + + MongoClusterImpl(String name, com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerObject = new MongoClusterInner(); + this.serviceManager = serviceManager; + this.mongoClusterName = name; + } + + public MongoClusterImpl update() { + this.updateProperties = new MongoClusterUpdate(); + return this; + } + + public MongoCluster apply() { + this.innerObject = serviceManager.serviceClient() + .getMongoClusters() + .update(resourceGroupName, mongoClusterName, updateProperties, Context.NONE); + return this; + } + + public MongoCluster apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMongoClusters() + .update(resourceGroupName, mongoClusterName, updateProperties, context); + return this; + } + + MongoClusterImpl(MongoClusterInner innerObject, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.mongoClusterName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "mongoClusters"); + } + + public MongoCluster refresh() { + this.innerObject = serviceManager.serviceClient() + .getMongoClusters() + .getByResourceGroupWithResponse(resourceGroupName, mongoClusterName, Context.NONE) + .getValue(); + return this; + } + + public MongoCluster refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMongoClusters() + .getByResourceGroupWithResponse(resourceGroupName, mongoClusterName, context) + .getValue(); + return this; + } + + public Response listConnectionStringsWithResponse(Context context) { + return serviceManager.mongoClusters() + .listConnectionStringsWithResponse(resourceGroupName, mongoClusterName, context); + } + + public ListConnectionStringsResult listConnectionStrings() { + return serviceManager.mongoClusters().listConnectionStrings(resourceGroupName, mongoClusterName); + } + + public MongoClusterImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public MongoClusterImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public MongoClusterImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public MongoClusterImpl withProperties(MongoClusterProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public MongoClusterImpl withProperties(MongoClusterUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientBuilder.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientBuilder.java new file mode 100644 index 0000000000000..8a82732985455 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the MongoClusterManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { MongoClusterManagementClientImpl.class }) +public final class MongoClusterManagementClientBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the MongoClusterManagementClientBuilder. + */ + public MongoClusterManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MongoClusterManagementClientBuilder. + */ + public MongoClusterManagementClientBuilder 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 MongoClusterManagementClientBuilder. + */ + public MongoClusterManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the MongoClusterManagementClientBuilder. + */ + public MongoClusterManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the MongoClusterManagementClientBuilder. + */ + public MongoClusterManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the MongoClusterManagementClientBuilder. + */ + public MongoClusterManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MongoClusterManagementClientImpl with the provided parameters. + * + * @return an instance of MongoClusterManagementClientImpl. + */ + public MongoClusterManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + MongoClusterManagementClientImpl client = new MongoClusterManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientImpl.java new file mode 100644 index 0000000000000..3533e331667f0 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientImpl.java @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.mongocluster.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mongocluster.fluent.MongoClusterManagementClient; +import com.azure.resourcemanager.mongocluster.fluent.MongoClustersClient; +import com.azure.resourcemanager.mongocluster.fluent.OperationsClient; +import com.azure.resourcemanager.mongocluster.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mongocluster.fluent.PrivateLinksClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the MongoClusterManagementClientImpl type. + */ +@ServiceClient(builder = MongoClusterManagementClientBuilder.class) +public final class MongoClusterManagementClientImpl implements MongoClusterManagementClient { + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @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 MongoClustersClient object to access its operations. + */ + private final MongoClustersClient mongoClusters; + + /** + * Gets the MongoClustersClient object to access its operations. + * + * @return the MongoClustersClient object. + */ + public MongoClustersClient getMongoClusters() { + return this.mongoClusters; + } + + /** + * The FirewallRulesClient object to access its operations. + */ + private final FirewallRulesClient firewallRules; + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + public FirewallRulesClient getFirewallRules() { + return this.firewallRules; + } + + /** + * 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 PrivateLinksClient object to access its operations. + */ + private final PrivateLinksClient privateLinks; + + /** + * Gets the PrivateLinksClient object to access its operations. + * + * @return the PrivateLinksClient object. + */ + public PrivateLinksClient getPrivateLinks() { + return this.privateLinks; + } + + /** + * Initializes an instance of MongoClusterManagementClient 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 ID of the target subscription. The value must be an UUID. + * @param endpoint server parameter. + */ + MongoClusterManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2024-03-01-preview"; + this.operations = new OperationsClientImpl(this); + this.mongoClusters = new MongoClustersClientImpl(this); + this.firewallRules = new FirewallRulesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinks = new PrivateLinksClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoClusterManagementClientImpl.class); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersClientImpl.java new file mode 100644 index 0000000000000..594d2b862c19d --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersClientImpl.java @@ -0,0 +1,1584 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mongocluster.fluent.MongoClustersClient; +import com.azure.resourcemanager.mongocluster.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mongocluster.fluent.models.ListConnectionStringsResultInner; +import com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner; +import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.mongocluster.models.MongoClusterListResult; +import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MongoClustersClient. + */ +public final class MongoClustersClientImpl implements MongoClustersClient { + /** + * The proxy service used to perform REST calls. + */ + private final MongoClustersService service; + + /** + * The service client containing this operation class. + */ + private final MongoClusterManagementClientImpl client; + + /** + * Initializes an instance of MongoClustersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MongoClustersClientImpl(MongoClusterManagementClientImpl client) { + this.service + = RestProxy.create(MongoClustersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MongoClusterManagementClientMongoClusters to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MongoClusterManageme") + public interface MongoClustersService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/checkMongoClusterNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @BodyParam("application/json") CheckNameAvailabilityRequest body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @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.DocumentDB/mongoClusters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, + @BodyParam("application/json") MongoClusterInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, + @BodyParam("application/json") MongoClusterUpdate properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/listConnectionStrings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listConnectionStrings(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @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("Accept") String accept, Context context); + } + + /** + * Check if mongo cluster name is available for use. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability 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 check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync(String location, + CheckNameAvailabilityRequest body) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkNameAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), location, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check if mongo cluster name is available for use. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability 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 check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync(String location, + CheckNameAvailabilityRequest body, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.checkNameAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, body, accept, context); + } + + /** + * Check if mongo cluster name is available for use. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability 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 check availability result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(String location, + CheckNameAvailabilityRequest body) { + return checkNameAvailabilityWithResponseAsync(location, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Check if mongo cluster name is available for use. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability 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 check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse(String location, + CheckNameAvailabilityRequest body, Context context) { + return checkNameAvailabilityWithResponseAsync(location, body, context).block(); + } + + /** + * Check if mongo cluster name is available for use. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability 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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkNameAvailability(String location, + CheckNameAvailabilityRequest body) { + return checkNameAvailabilityWithResponse(location, body, Context.NONE).getValue(); + } + + /** + * List all the mongo clusters in a 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 the response of a MongoCluster list operation 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.")); + } + 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(), 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())); + } + + /** + * List all the mongo clusters in a given subscription. + * + * @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 response of a MongoCluster list operation 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.")); + } + 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(), 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)); + } + + /** + * List all the mongo clusters in a 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 the response of a MongoCluster list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the mongo clusters in a given subscription. + * + * @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 response of a MongoCluster list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the mongo clusters in a 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 the response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the mongo clusters in a given subscription. + * + * @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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a MongoCluster list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, 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())); + } + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a MongoCluster list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a MongoCluster list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a MongoCluster list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets information about a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a mongo cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String mongoClusterName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 information about a mongo cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String mongoClusterName, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, accept, context); + } + + /** + * Gets information about a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a mongo cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String mongoClusterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, mongoClusterName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 information about a mongo cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String mongoClusterName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, mongoClusterName, context).block(); + } + + /** + * Gets information about a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a mongo cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoClusterInner getByResourceGroup(String resourceGroupName, String mongoClusterName) { + return getByResourceGroupWithResponse(resourceGroupName, mongoClusterName, Context.NONE).getValue(); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a mongo cluster resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String mongoClusterName, MongoClusterInner resource) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @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 represents a mongo cluster resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String mongoClusterName, MongoClusterInner resource, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, resource, accept, context); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoClusterInner> + beginCreateOrUpdateAsync(String resourceGroupName, String mongoClusterName, MongoClusterInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, mongoClusterName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + MongoClusterInner.class, MongoClusterInner.class, this.client.getContext()); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoClusterInner> beginCreateOrUpdateAsync( + String resourceGroupName, String mongoClusterName, MongoClusterInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, mongoClusterName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + MongoClusterInner.class, MongoClusterInner.class, context); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoClusterInner> beginCreateOrUpdate(String resourceGroupName, + String mongoClusterName, MongoClusterInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, mongoClusterName, resource).getSyncPoller(); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoClusterInner> beginCreateOrUpdate(String resourceGroupName, + String mongoClusterName, MongoClusterInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, mongoClusterName, resource, context).getSyncPoller(); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a mongo cluster resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String mongoClusterName, + MongoClusterInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, mongoClusterName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @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 represents a mongo cluster resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String mongoClusterName, + MongoClusterInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, mongoClusterName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoClusterInner createOrUpdate(String resourceGroupName, String mongoClusterName, + MongoClusterInner resource) { + return createOrUpdateAsync(resourceGroupName, mongoClusterName, resource).block(); + } + + /** + * Create or update a mongo cluster. Update overwrites all properties for the resource. To only modify some of the + * properties, use PATCH. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param resource Resource create parameters. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoClusterInner createOrUpdate(String resourceGroupName, String mongoClusterName, + MongoClusterInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, mongoClusterName, resource, context).block(); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a mongo cluster resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String mongoClusterName, + MongoClusterUpdate properties) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @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 represents a mongo cluster resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String mongoClusterName, + MongoClusterUpdate properties, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, properties, accept, context); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoClusterInner> beginUpdateAsync(String resourceGroupName, + String mongoClusterName, MongoClusterUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, mongoClusterName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + MongoClusterInner.class, MongoClusterInner.class, this.client.getContext()); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MongoClusterInner> beginUpdateAsync(String resourceGroupName, + String mongoClusterName, MongoClusterUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, mongoClusterName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + MongoClusterInner.class, MongoClusterInner.class, context); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoClusterInner> beginUpdate(String resourceGroupName, + String mongoClusterName, MongoClusterUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, mongoClusterName, properties).getSyncPoller(); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MongoClusterInner> beginUpdate(String resourceGroupName, + String mongoClusterName, MongoClusterUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, mongoClusterName, properties, context).getSyncPoller(); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a mongo cluster resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String mongoClusterName, + MongoClusterUpdate properties) { + return beginUpdateAsync(resourceGroupName, mongoClusterName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @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 represents a mongo cluster resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String mongoClusterName, + MongoClusterUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, mongoClusterName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoClusterInner update(String resourceGroupName, String mongoClusterName, MongoClusterUpdate properties) { + return updateAsync(resourceGroupName, mongoClusterName, properties).block(); + } + + /** + * Updates an existing mongo cluster. The request body can contain one to many of the properties present in the + * normal mongo cluster definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param properties The resource properties to be updated. + * @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 represents a mongo cluster resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MongoClusterInner update(String resourceGroupName, String mongoClusterName, MongoClusterUpdate properties, + Context context) { + return updateAsync(resourceGroupName, mongoClusterName, properties, context).block(); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName, + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, accept, context); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, mongoClusterName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, mongoClusterName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName) { + return this.beginDeleteAsync(resourceGroupName, mongoClusterName).getSyncPoller(); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, mongoClusterName, context).getSyncPoller(); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName) { + return beginDeleteAsync(resourceGroupName, mongoClusterName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName, Context context) { + return beginDeleteAsync(resourceGroupName, mongoClusterName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 mongoClusterName) { + deleteAsync(resourceGroupName, mongoClusterName).block(); + } + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName, Context context) { + deleteAsync(resourceGroupName, mongoClusterName, context).block(); + } + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 connection strings for the given mongo cluster along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listConnectionStringsWithResponseAsync(String resourceGroupName, String mongoClusterName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listConnectionStrings(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 connection strings for the given mongo cluster along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listConnectionStringsWithResponseAsync(String resourceGroupName, String mongoClusterName, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listConnectionStrings(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, accept, context); + } + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 connection strings for the given mongo cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConnectionStringsAsync(String resourceGroupName, + String mongoClusterName) { + return listConnectionStringsWithResponseAsync(resourceGroupName, mongoClusterName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 connection strings for the given mongo cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConnectionStringsWithResponse(String resourceGroupName, + String mongoClusterName, Context context) { + return listConnectionStringsWithResponseAsync(resourceGroupName, mongoClusterName, context).block(); + } + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 connection strings for the given mongo cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String mongoClusterName) { + return listConnectionStringsWithResponse(resourceGroupName, mongoClusterName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MongoCluster list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MongoCluster list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a MongoCluster list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MongoCluster list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersImpl.java new file mode 100644 index 0000000000000..6ec15135b2c48 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.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.mongocluster.fluent.MongoClustersClient; +import com.azure.resourcemanager.mongocluster.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mongocluster.fluent.models.ListConnectionStringsResultInner; +import com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner; +import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.mongocluster.models.ListConnectionStringsResult; +import com.azure.resourcemanager.mongocluster.models.MongoCluster; +import com.azure.resourcemanager.mongocluster.models.MongoClusters; + +public final class MongoClustersImpl implements MongoClusters { + private static final ClientLogger LOGGER = new ClientLogger(MongoClustersImpl.class); + + private final MongoClustersClient innerClient; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + public MongoClustersImpl(MongoClustersClient innerClient, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response checkNameAvailabilityWithResponse(String location, + CheckNameAvailabilityRequest body, Context context) { + Response inner + = this.serviceClient().checkNameAvailabilityWithResponse(location, body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResponse checkNameAvailability(String location, CheckNameAvailabilityRequest body) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkNameAvailability(location, body); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MongoClusterImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MongoClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MongoClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MongoClusterImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String mongoClusterName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, mongoClusterName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MongoClusterImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MongoCluster getByResourceGroup(String resourceGroupName, String mongoClusterName) { + MongoClusterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, mongoClusterName); + if (inner != null) { + return new MongoClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String mongoClusterName) { + this.serviceClient().delete(resourceGroupName, mongoClusterName); + } + + public void delete(String resourceGroupName, String mongoClusterName, Context context) { + this.serviceClient().delete(resourceGroupName, mongoClusterName, context); + } + + public Response listConnectionStringsWithResponse(String resourceGroupName, + String mongoClusterName, Context context) { + Response inner + = this.serviceClient().listConnectionStringsWithResponse(resourceGroupName, mongoClusterName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ListConnectionStringsResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ListConnectionStringsResult listConnectionStrings(String resourceGroupName, String mongoClusterName) { + ListConnectionStringsResultInner inner + = this.serviceClient().listConnectionStrings(resourceGroupName, mongoClusterName); + if (inner != null) { + return new ListConnectionStringsResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public MongoCluster getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, mongoClusterName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, mongoClusterName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + this.delete(resourceGroupName, mongoClusterName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + this.delete(resourceGroupName, mongoClusterName, context); + } + + private MongoClustersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } + + public MongoClusterImpl define(String name) { + return new MongoClusterImpl(name, this.manager()); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationImpl.java new file mode 100644 index 0000000000000..a3e07c629b0ca --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationImpl.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.mongocluster.implementation; + +import com.azure.resourcemanager.mongocluster.fluent.models.OperationInner; +import com.azure.resourcemanager.mongocluster.models.ActionType; +import com.azure.resourcemanager.mongocluster.models.Operation; +import com.azure.resourcemanager.mongocluster.models.OperationDisplay; +import com.azure.resourcemanager.mongocluster.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..7b6f68a51dfa5 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsClientImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.mongocluster.fluent.OperationsClient; +import com.azure.resourcemanager.mongocluster.fluent.models.OperationInner; +import com.azure.resourcemanager.mongocluster.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final MongoClusterManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MongoClusterManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MongoClusterManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MongoClusterManageme") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.DocumentDB/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider 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(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider 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(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..f6848113d939a --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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.mongocluster.fluent.OperationsClient; +import com.azure.resourcemanager.mongocluster.fluent.models.OperationInner; +import com.azure.resourcemanager.mongocluster.models.Operation; +import com.azure.resourcemanager.mongocluster.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionResourceImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionResourceImpl.java new file mode 100644 index 0000000000000..29cde3a8bd44b --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionResourceImpl.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionResource; + +public final class PrivateEndpointConnectionResourceImpl + implements PrivateEndpointConnectionResource, PrivateEndpointConnectionResource.Definition { + private PrivateEndpointConnectionResourceInner innerObject; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + PrivateEndpointConnectionResourceImpl(PrivateEndpointConnectionResourceInner innerObject, + com.azure.resourcemanager.mongocluster.MongoClusterManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public PrivateEndpointConnectionResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String mongoClusterName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionResourceImpl withExistingMongoCluster(String resourceGroupName, + String mongoClusterName) { + this.resourceGroupName = resourceGroupName; + this.mongoClusterName = mongoClusterName; + return this; + } + + public PrivateEndpointConnectionResource create() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .create(resourceGroupName, mongoClusterName, privateEndpointConnectionName, this.innerModel(), + Context.NONE); + return this; + } + + public PrivateEndpointConnectionResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .create(resourceGroupName, mongoClusterName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionResourceImpl(String name, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionResourceInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, mongoClusterName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnectionResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionResourceImpl withProperties(PrivateEndpointConnectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..d48401aeb542d --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1003 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mongocluster.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionResourceListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. + */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateEndpointConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final MongoClusterManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(MongoClusterManagementClientImpl client) { + this.service = RestProxy.create(PrivateEndpointConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MongoClusterManagementClientPrivateEndpointConnections to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MongoClusterManageme") + public interface PrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByMongoCluster( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionResourceInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByMongoClusterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByMongoClusterSinglePageAsync(String resourceGroupName, String mongoClusterName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByMongoCluster(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, 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())); + } + + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByMongoClusterSinglePageAsync(String resourceGroupName, String mongoClusterName, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByMongoCluster(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByMongoClusterAsync(String resourceGroupName, + String mongoClusterName) { + return new PagedFlux<>(() -> listByMongoClusterSinglePageAsync(resourceGroupName, mongoClusterName), + nextLink -> listByMongoClusterNextSinglePageAsync(nextLink)); + } + + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByMongoClusterAsync(String resourceGroupName, + String mongoClusterName, Context context) { + return new PagedFlux<>(() -> listByMongoClusterSinglePageAsync(resourceGroupName, mongoClusterName, context), + nextLink -> listByMongoClusterNextSinglePageAsync(nextLink, context)); + } + + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByMongoCluster(String resourceGroupName, + String mongoClusterName) { + return new PagedIterable<>(listByMongoClusterAsync(resourceGroupName, mongoClusterName)); + } + + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByMongoCluster(String resourceGroupName, + String mongoClusterName, Context context) { + return new PagedIterable<>(listByMongoClusterAsync(resourceGroupName, mongoClusterName, context)); + } + + /** + * Get a specific private connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specific private connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String mongoClusterName, String privateEndpointConnectionName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, privateEndpointConnectionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific private connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 specific private connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String mongoClusterName, String privateEndpointConnectionName, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, privateEndpointConnectionName, accept, context); + } + + /** + * Get a specific private connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specific private connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific private connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 specific private connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String mongoClusterName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context) + .block(); + } + + /** + * Get a specific private connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 specific private connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionResourceInner get(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, mongoClusterName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner resource) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, privateEndpointConnectionName, + resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @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 concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner resource, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource, accept, context); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionResourceInner> + beginCreateAsync(String resourceGroupName, String mongoClusterName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner resource) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), PrivateEndpointConnectionResourceInner.class, + PrivateEndpointConnectionResourceInner.class, this.client.getContext()); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @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 concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionResourceInner> + beginCreateAsync(String resourceGroupName, String mongoClusterName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, mongoClusterName, + privateEndpointConnectionName, resource, context); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), PrivateEndpointConnectionResourceInner.class, + PrivateEndpointConnectionResourceInner.class, context); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionResourceInner> + beginCreate(String resourceGroupName, String mongoClusterName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner resource) { + return this.beginCreateAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource) + .getSyncPoller(); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @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 concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionResourceInner> + beginCreate(String resourceGroupName, String mongoClusterName, String privateEndpointConnectionName, + PrivateEndpointConnectionResourceInner resource, Context context) { + return this + .beginCreateAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource, context) + .getSyncPoller(); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner resource) { + return beginCreateAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @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 concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner resource, Context context) { + return beginCreateAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionResourceInner create(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner resource) { + return createAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource).block(); + } + + /** + * Create a Private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @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 concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionResourceInner create(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, PrivateEndpointConnectionResourceInner resource, Context context) { + return createAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource, context) + .block(); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName, + String privateEndpointConnectionName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, privateEndpointConnectionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, + String privateEndpointConnectionName, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, privateEndpointConnectionName, accept, context); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName, + String privateEndpointConnectionName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, + String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName, + String privateEndpointConnectionName) { + return this.beginDeleteAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName) + .getSyncPoller(); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, + String privateEndpointConnectionName, Context context) { + return this.beginDeleteAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context) + .getSyncPoller(); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 mongoClusterName, + String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, + String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 mongoClusterName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName).block(); + } + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, String privateEndpointConnectionName, + Context context) { + deleteAsync(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByMongoClusterNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByMongoClusterNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateEndpointConnectionResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByMongoClusterNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByMongoClusterNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..b9d74f1fd67b2 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.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.mongocluster.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionResource; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnections; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByMongoCluster(String resourceGroupName, + String mongoClusterName) { + PagedIterable inner + = this.serviceClient().listByMongoCluster(resourceGroupName, mongoClusterName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PrivateEndpointConnectionResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByMongoCluster(String resourceGroupName, + String mongoClusterName, Context context) { + PagedIterable inner + = this.serviceClient().listByMongoCluster(resourceGroupName, mongoClusterName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new PrivateEndpointConnectionResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, + String mongoClusterName, String privateEndpointConnectionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateEndpointConnectionResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnectionResource get(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName) { + PrivateEndpointConnectionResourceInner inner + = this.serviceClient().get(resourceGroupName, mongoClusterName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String mongoClusterName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, mongoClusterName, privateEndpointConnectionName); + } + + public void delete(String resourceGroupName, String mongoClusterName, String privateEndpointConnectionName, + Context context) { + this.serviceClient().delete(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context); + } + + public PrivateEndpointConnectionResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, mongoClusterName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, mongoClusterName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String mongoClusterName = ResourceManagerUtils.getValueFromIdByName(id, "mongoClusters"); + if (mongoClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'mongoClusters'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, mongoClusterName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionResourceImpl define(String name) { + return new PrivateEndpointConnectionResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinkResourceImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..94294069d048d --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinkResourceImpl.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.mongocluster.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongocluster.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mongocluster.models.PrivateLinkResource; +import com.azure.resourcemanager.mongocluster.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.mongocluster.MongoClusterManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksClientImpl.java new file mode 100644 index 0000000000000..4331a38e27230 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksClientImpl.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.mongocluster.fluent.PrivateLinksClient; +import com.azure.resourcemanager.mongocluster.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mongocluster.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinksClient. + */ +public final class PrivateLinksClientImpl implements PrivateLinksClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateLinksService service; + + /** + * The service client containing this operation class. + */ + private final MongoClusterManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinksClientImpl(MongoClusterManagementClientImpl client) { + this.service + = RestProxy.create(PrivateLinksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MongoClusterManagementClientPrivateLinks to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MongoClusterManageme") + public interface PrivateLinksService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByMongoCluster(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByMongoClusterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a PrivateLinkResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMongoClusterSinglePageAsync(String resourceGroupName, + String mongoClusterName) { + 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByMongoCluster(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, 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())); + } + + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateLinkResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMongoClusterSinglePageAsync(String resourceGroupName, + String mongoClusterName, 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 (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByMongoCluster(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a PrivateLinkResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByMongoClusterAsync(String resourceGroupName, + String mongoClusterName) { + return new PagedFlux<>(() -> listByMongoClusterSinglePageAsync(resourceGroupName, mongoClusterName), + nextLink -> listByMongoClusterNextSinglePageAsync(nextLink)); + } + + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateLinkResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByMongoClusterAsync(String resourceGroupName, + String mongoClusterName, Context context) { + return new PagedFlux<>(() -> listByMongoClusterSinglePageAsync(resourceGroupName, mongoClusterName, context), + nextLink -> listByMongoClusterNextSinglePageAsync(nextLink, context)); + } + + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByMongoCluster(String resourceGroupName, + String mongoClusterName) { + return new PagedIterable<>(listByMongoClusterAsync(resourceGroupName, mongoClusterName)); + } + + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, + Context context) { + return new PagedIterable<>(listByMongoClusterAsync(resourceGroupName, mongoClusterName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMongoClusterNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByMongoClusterNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PrivateLinkResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMongoClusterNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByMongoClusterNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksImpl.java new file mode 100644 index 0000000000000..4077660d608ef --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.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.mongocluster.fluent.PrivateLinksClient; +import com.azure.resourcemanager.mongocluster.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mongocluster.models.PrivateLinkResource; +import com.azure.resourcemanager.mongocluster.models.PrivateLinks; + +public final class PrivateLinksImpl implements PrivateLinks { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinksImpl.class); + + private final PrivateLinksClient innerClient; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + public PrivateLinksImpl(PrivateLinksClient innerClient, + com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName) { + PagedIterable inner + = this.serviceClient().listByMongoCluster(resourceGroupName, mongoClusterName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, + Context context) { + PagedIterable inner + = this.serviceClient().listByMongoCluster(resourceGroupName, mongoClusterName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + private PrivateLinksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ResourceManagerUtils.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..e8dde58e8c4ec --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/package-info.java new file mode 100644 index 0000000000000..fbcee02138dd0 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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 MongoClusterManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for + * MongoDB vCore resources including clusters and firewall rules. + */ +package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ActionType.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ActionType.java new file mode 100644 index 0000000000000..f432a2a1974da --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ActionType.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/AzureResourceManagerPrivateEndpointConnection.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/AzureResourceManagerPrivateEndpointConnection.java new file mode 100644 index 0000000000000..3b9810bdc16a4 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/AzureResourceManagerPrivateEndpointConnection.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The private endpoint connection resource. + */ +@Fluent +public final class AzureResourceManagerPrivateEndpointConnection extends ProxyResource { + /* + * The private endpoint connection properties + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of AzureResourceManagerPrivateEndpointConnection class. + */ + public AzureResourceManagerPrivateEndpointConnection() { + } + + /** + * Get the properties property: The private endpoint connection properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The private endpoint connection properties. + * + * @param properties the properties value to set. + * @return the AzureResourceManagerPrivateEndpointConnection object itself. + */ + public AzureResourceManagerPrivateEndpointConnection + withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityReason.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..949ede94bec1b --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityReason.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.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The reason why the given name is not available. + */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** + * Static value Invalid for CheckNameAvailabilityReason. + */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** + * Static value AlreadyExists for CheckNameAvailabilityReason. + */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of CheckNameAvailabilityReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CheckNameAvailabilityReason() { + } + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** + * Gets known CheckNameAvailabilityReason values. + * + * @return known CheckNameAvailabilityReason values. + */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityRequest.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..555324159f4e0 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The check availability request body. + */ +@Fluent +public final class CheckNameAvailabilityRequest { + /* + * The name of the resource for which availability needs to be checked. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Creates an instance of CheckNameAvailabilityRequest class. + */ + public CheckNameAvailabilityRequest() { + } + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityResponse.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..eab187dd161d5 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityResponse.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.mongocluster.models; + +import com.azure.resourcemanager.mongocluster.fluent.models.CheckNameAvailabilityResponseInner; + +/** + * An immutable client-side representation of CheckNameAvailabilityResponse. + */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Detailed reason why the given name is available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.mongocluster.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java new file mode 100644 index 0000000000000..417e9e33e3476 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.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.mongocluster.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Connection string for the mongo cluster. + */ +@Immutable +public final class ConnectionString { + /* + * Value of the connection string + */ + @JsonProperty(value = "connectionString", access = JsonProperty.Access.WRITE_ONLY) + private String connectionString; + + /* + * Description of the connection string + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Creates an instance of ConnectionString class. + */ + public ConnectionString() { + } + + /** + * Get the connectionString property: Value of the connection string. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Get the description property: Description of the connection string. + * + * @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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CreateMode.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CreateMode.java new file mode 100644 index 0000000000000..d3ca75a890807 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CreateMode.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.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The mode that the Mongo Cluster is created with. + */ +public final class CreateMode extends ExpandableStringEnum { + /** + * Static value Default for CreateMode. + */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** + * Static value PointInTimeRestore for CreateMode. + */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates a new instance of CreateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CreateMode() { + } + + /** + * Creates or finds a CreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreateMode. + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** + * Gets known CreateMode values. + * + * @return known CreateMode values. + */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRule.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRule.java new file mode 100644 index 0000000000000..b3dae451ea2af --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRule.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongocluster.fluent.models.FirewallRuleInner; + +/** + * An immutable client-side representation of FirewallRule. + */ +public interface FirewallRule { + /** + * 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: The resource-specific properties for this resource. + * + * @return the properties value. + */ + FirewallRuleProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.mongocluster.fluent.models.FirewallRuleInner object. + * + * @return the inner object. + */ + FirewallRuleInner innerModel(); + + /** + * The entirety of the FirewallRule definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The FirewallRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the FirewallRule definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the FirewallRule definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, mongoClusterName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @return the next definition stage. + */ + WithCreate withExistingMongoCluster(String resourceGroupName, String mongoClusterName); + } + + /** + * The stage of the FirewallRule 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + FirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FirewallRule create(Context context); + } + + /** + * The stage of the FirewallRule definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(FirewallRuleProperties properties); + } + } + + /** + * Begins update for the FirewallRule resource. + * + * @return the stage of resource update. + */ + FirewallRule.Update update(); + + /** + * The template for FirewallRule update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FirewallRule apply(Context context); + } + + /** + * The FirewallRule update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FirewallRule refresh(Context context); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleListResult.java new file mode 100644 index 0000000000000..a44fe70bc113a --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleListResult.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mongocluster.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a FirewallRule list operation. + */ +@Fluent +public final class FirewallRuleListResult { + /* + * The FirewallRule items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Creates an instance of FirewallRuleListResult class. + */ + public FirewallRuleListResult() { + } + + /** + * Get the value property: The FirewallRule items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The FirewallRule items on this page. + * + * @param value the value value to set. + * @return the FirewallRuleListResult object itself. + */ + public FirewallRuleListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the FirewallRuleListResult object itself. + */ + public FirewallRuleListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model FirewallRuleListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleListResult.class); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleProperties.java new file mode 100644 index 0000000000000..08a2a90653b30 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleProperties.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a mongo cluster firewall rule. + */ +@Fluent +public final class FirewallRuleProperties { + /* + * The provisioning state of the firewall rule. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The start IP address of the mongo cluster firewall rule. Must be IPv4 format. + */ + @JsonProperty(value = "startIpAddress", required = true) + private String startIpAddress; + + /* + * The end IP address of the mongo cluster firewall rule. Must be IPv4 format. + */ + @JsonProperty(value = "endIpAddress", required = true) + private String endIpAddress; + + /** + * Creates an instance of FirewallRuleProperties class. + */ + public FirewallRuleProperties() { + } + + /** + * Get the provisioningState property: The provisioning state of the firewall rule. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the startIpAddress property: The start IP address of the mongo cluster firewall rule. Must be IPv4 format. + * + * @return the startIpAddress value. + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the startIpAddress property: The start IP address of the mongo cluster firewall rule. Must be IPv4 format. + * + * @param startIpAddress the startIpAddress value to set. + * @return the FirewallRuleProperties object itself. + */ + public FirewallRuleProperties withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the endIpAddress property: The end IP address of the mongo cluster firewall rule. Must be IPv4 format. + * + * @return the endIpAddress value. + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the endIpAddress property: The end IP address of the mongo cluster firewall rule. Must be IPv4 format. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRuleProperties object itself. + */ + public FirewallRuleProperties withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (startIpAddress() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property startIpAddress in model FirewallRuleProperties")); + } + if (endIpAddress() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property endIpAddress in model FirewallRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleProperties.class); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRules.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRules.java new file mode 100644 index 0000000000000..57b91da7b1cff --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRules.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of FirewallRules. + */ +public interface FirewallRules { + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a FirewallRule list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName); + + /** + * List all the firewall rules in a given mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a FirewallRule list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, Context context); + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 information about a mongo cluster firewall rule along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String mongoClusterName, String firewallRuleName, + Context context); + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 information about a mongo cluster firewall rule. + */ + FirewallRule get(String resourceGroupName, String mongoClusterName, String firewallRuleName); + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, String firewallRuleName); + + /** + * Deletes a mongo cluster firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param firewallRuleName The name of the mongo cluster firewall rule. + * @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 mongoClusterName, String firewallRuleName, Context context); + + /** + * Gets information about a mongo cluster firewall rule. + * + * @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 information about a mongo cluster firewall rule along with {@link Response}. + */ + FirewallRule getById(String id); + + /** + * Gets information about a mongo cluster firewall rule. + * + * @param id the resource ID. + * @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 information about a mongo cluster firewall rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a mongo cluster firewall rule. + * + * @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 mongo cluster firewall rule. + * + * @param id the resource ID. + * @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, Context context); + + /** + * Begins definition for a new FirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new FirewallRule definition. + */ + FirewallRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ListConnectionStringsResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ListConnectionStringsResult.java new file mode 100644 index 0000000000000..49e96a9a3630f --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ListConnectionStringsResult.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.resourcemanager.mongocluster.fluent.models.ListConnectionStringsResultInner; +import java.util.List; + +/** + * An immutable client-side representation of ListConnectionStringsResult. + */ +public interface ListConnectionStringsResult { + /** + * Gets the connectionStrings property: An array that contains the connection strings for a mongo cluster. + * + * @return the connectionStrings value. + */ + List connectionStrings(); + + /** + * Gets the inner com.azure.resourcemanager.mongocluster.fluent.models.ListConnectionStringsResultInner object. + * + * @return the inner object. + */ + ListConnectionStringsResultInner innerModel(); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoCluster.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoCluster.java new file mode 100644 index 0000000000000..8567c7362b948 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoCluster.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner; +import java.util.Map; + +/** + * An immutable client-side representation of MongoCluster. + */ +public interface MongoCluster { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + MongoClusterProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner object. + * + * @return the inner object. + */ + MongoClusterInner innerModel(); + + /** + * The entirety of the MongoCluster definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The MongoCluster definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MongoCluster definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the MongoCluster 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 MongoCluster definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the MongoCluster 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + MongoCluster create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MongoCluster create(Context context); + } + + /** + * The stage of the MongoCluster 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 MongoCluster definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(MongoClusterProperties properties); + } + } + + /** + * Begins update for the MongoCluster resource. + * + * @return the stage of resource update. + */ + MongoCluster.Update update(); + + /** + * The template for MongoCluster update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MongoCluster apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MongoCluster apply(Context context); + } + + /** + * The MongoCluster update stages. + */ + interface UpdateStages { + /** + * The stage of the MongoCluster update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the MongoCluster update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The updatable properties of the MongoCluster.. + * + * @param properties The updatable properties of the MongoCluster. + * @return the next definition stage. + */ + Update withProperties(MongoClusterUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MongoCluster refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MongoCluster refresh(Context context); + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @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 connection strings for the given mongo cluster along with {@link Response}. + */ + Response listConnectionStringsWithResponse(Context context); + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @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 connection strings for the given mongo cluster. + */ + ListConnectionStringsResult listConnectionStrings(); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterListResult.java new file mode 100644 index 0000000000000..f0d788f38f9de --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterListResult.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a MongoCluster list operation. + */ +@Fluent +public final class MongoClusterListResult { + /* + * The MongoCluster items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Creates an instance of MongoClusterListResult class. + */ + public MongoClusterListResult() { + } + + /** + * Get the value property: The MongoCluster items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The MongoCluster items on this page. + * + * @param value the value value to set. + * @return the MongoClusterListResult object itself. + */ + public MongoClusterListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the MongoClusterListResult object itself. + */ + public MongoClusterListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model MongoClusterListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoClusterListResult.class); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterProperties.java new file mode 100644 index 0000000000000..6c7be919e5d14 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterProperties.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The properties of a mongo cluster. + */ +@Fluent +public final class MongoClusterProperties { + /* + * The mode to create a mongo cluster. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /* + * The parameters to create a point-in-time restore mongo cluster. + */ + @JsonProperty(value = "restoreParameters") + private MongoClusterRestoreParameters restoreParameters; + + /* + * The administrator's login for the mongo cluster. + */ + @JsonProperty(value = "administratorLogin") + private String administratorLogin; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The Mongo DB server version. Defaults to the latest available version if not specified. + */ + @JsonProperty(value = "serverVersion") + private String serverVersion; + + /* + * The default mongo connection string for the cluster. + */ + @JsonProperty(value = "connectionString", access = JsonProperty.Access.WRITE_ONLY) + private String connectionString; + + /* + * Earliest restore timestamp in UTC ISO8601 format. + */ + @JsonProperty(value = "earliestRestoreTime", access = JsonProperty.Access.WRITE_ONLY) + private String earliestRestoreTime; + + /* + * The provisioning state of the mongo cluster. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The status of the mongo cluster. + */ + @JsonProperty(value = "clusterStatus", access = JsonProperty.Access.WRITE_ONLY) + private MongoClusterStatus clusterStatus; + + /* + * Whether or not public endpoint access is allowed for this mongo cluster. + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * The list of node group specs in the cluster. + */ + @JsonProperty(value = "nodeGroupSpecs") + private List nodeGroupSpecs; + + /* + * List of private endpoint connections. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /** + * Creates an instance of MongoClusterProperties class. + */ + public MongoClusterProperties() { + } + + /** + * Get the createMode property: The mode to create a mongo cluster. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: The mode to create a mongo cluster. + * + * @param createMode the createMode value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the restoreParameters property: The parameters to create a point-in-time restore mongo cluster. + * + * @return the restoreParameters value. + */ + public MongoClusterRestoreParameters restoreParameters() { + return this.restoreParameters; + } + + /** + * Set the restoreParameters property: The parameters to create a point-in-time restore mongo cluster. + * + * @param restoreParameters the restoreParameters value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withRestoreParameters(MongoClusterRestoreParameters restoreParameters) { + this.restoreParameters = restoreParameters; + return this; + } + + /** + * Get the administratorLogin property: The administrator's login for the mongo cluster. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: The administrator's login for the mongo cluster. + * + * @param administratorLogin the administratorLogin value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the serverVersion property: The Mongo DB server version. Defaults to the latest available version if not + * specified. + * + * @return the serverVersion value. + */ + public String serverVersion() { + return this.serverVersion; + } + + /** + * Set the serverVersion property: The Mongo DB server version. Defaults to the latest available version if not + * specified. + * + * @param serverVersion the serverVersion value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withServerVersion(String serverVersion) { + this.serverVersion = serverVersion; + return this; + } + + /** + * Get the connectionString property: The default mongo connection string for the cluster. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Get the earliestRestoreTime property: Earliest restore timestamp in UTC ISO8601 format. + * + * @return the earliestRestoreTime value. + */ + public String earliestRestoreTime() { + return this.earliestRestoreTime; + } + + /** + * Get the provisioningState property: The provisioning state of the mongo cluster. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the clusterStatus property: The status of the mongo cluster. + * + * @return the clusterStatus value. + */ + public MongoClusterStatus clusterStatus() { + return this.clusterStatus; + } + + /** + * Get the publicNetworkAccess property: Whether or not public endpoint access is allowed for this mongo cluster. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public endpoint access is allowed for this mongo cluster. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the nodeGroupSpecs property: The list of node group specs in the cluster. + * + * @return the nodeGroupSpecs value. + */ + public List nodeGroupSpecs() { + return this.nodeGroupSpecs; + } + + /** + * Set the nodeGroupSpecs property: The list of node group specs in the cluster. + * + * @param nodeGroupSpecs the nodeGroupSpecs value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withNodeGroupSpecs(List nodeGroupSpecs) { + this.nodeGroupSpecs = nodeGroupSpecs; + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restoreParameters() != null) { + restoreParameters().validate(); + } + if (nodeGroupSpecs() != null) { + nodeGroupSpecs().forEach(e -> e.validate()); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterRestoreParameters.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterRestoreParameters.java new file mode 100644 index 0000000000000..4d2fd414ba2a5 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterRestoreParameters.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** + * Parameters used for restore operations. + */ +@Fluent +public final class MongoClusterRestoreParameters { + /* + * UTC point in time to restore a mongo cluster + */ + @JsonProperty(value = "pointInTimeUTC") + private OffsetDateTime pointInTimeUtc; + + /* + * Resource ID to locate the source cluster to restore + */ + @JsonProperty(value = "sourceResourceId") + private String sourceResourceId; + + /** + * Creates an instance of MongoClusterRestoreParameters class. + */ + public MongoClusterRestoreParameters() { + } + + /** + * Get the pointInTimeUtc property: UTC point in time to restore a mongo cluster. + * + * @return the pointInTimeUtc value. + */ + public OffsetDateTime pointInTimeUtc() { + return this.pointInTimeUtc; + } + + /** + * Set the pointInTimeUtc property: UTC point in time to restore a mongo cluster. + * + * @param pointInTimeUtc the pointInTimeUtc value to set. + * @return the MongoClusterRestoreParameters object itself. + */ + public MongoClusterRestoreParameters withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + this.pointInTimeUtc = pointInTimeUtc; + return this; + } + + /** + * Get the sourceResourceId property: Resource ID to locate the source cluster to restore. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Set the sourceResourceId property: Resource ID to locate the source cluster to restore. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the MongoClusterRestoreParameters object itself. + */ + public MongoClusterRestoreParameters withSourceResourceId(String sourceResourceId) { + this.sourceResourceId = sourceResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java new file mode 100644 index 0000000000000..70066c4e650b5 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.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.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The status of the Mongo cluster resource. + */ +public final class MongoClusterStatus extends ExpandableStringEnum { + /** + * Static value Ready for MongoClusterStatus. + */ + public static final MongoClusterStatus READY = fromString("Ready"); + + /** + * Static value Provisioning for MongoClusterStatus. + */ + public static final MongoClusterStatus PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for MongoClusterStatus. + */ + public static final MongoClusterStatus UPDATING = fromString("Updating"); + + /** + * Static value Starting for MongoClusterStatus. + */ + public static final MongoClusterStatus STARTING = fromString("Starting"); + + /** + * Static value Stopping for MongoClusterStatus. + */ + public static final MongoClusterStatus STOPPING = fromString("Stopping"); + + /** + * Static value Stopped for MongoClusterStatus. + */ + public static final MongoClusterStatus STOPPED = fromString("Stopped"); + + /** + * Static value Dropping for MongoClusterStatus. + */ + public static final MongoClusterStatus DROPPING = fromString("Dropping"); + + /** + * Creates a new instance of MongoClusterStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MongoClusterStatus() { + } + + /** + * Creates or finds a MongoClusterStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MongoClusterStatus. + */ + @JsonCreator + public static MongoClusterStatus fromString(String name) { + return fromString(name, MongoClusterStatus.class); + } + + /** + * Gets known MongoClusterStatus values. + * + * @return known MongoClusterStatus values. + */ + public static Collection values() { + return values(MongoClusterStatus.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdate.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdate.java new file mode 100644 index 0000000000000..8aaf507d1baa1 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdate.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * The type used for update operations of the MongoCluster. + */ +@Fluent +public final class MongoClusterUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The updatable properties of the MongoCluster. + */ + @JsonProperty(value = "properties") + private MongoClusterUpdateProperties properties; + + /** + * Creates an instance of MongoClusterUpdate class. + */ + public MongoClusterUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the MongoClusterUpdate object itself. + */ + public MongoClusterUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The updatable properties of the MongoCluster. + * + * @return the properties value. + */ + public MongoClusterUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The updatable properties of the MongoCluster. + * + * @param properties the properties value to set. + * @return the MongoClusterUpdate object itself. + */ + public MongoClusterUpdate withProperties(MongoClusterUpdateProperties 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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdateProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdateProperties.java new file mode 100644 index 0000000000000..2b3800b7a8466 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdateProperties.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The updatable properties of the MongoCluster. + */ +@Fluent +public final class MongoClusterUpdateProperties { + /* + * The administrator's login for the mongo cluster. + */ + @JsonProperty(value = "administratorLogin") + private String administratorLogin; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The Mongo DB server version. Defaults to the latest available version if not specified. + */ + @JsonProperty(value = "serverVersion") + private String serverVersion; + + /* + * Whether or not public endpoint access is allowed for this mongo cluster. + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * The list of node group specs in the cluster. + */ + @JsonProperty(value = "nodeGroupSpecs") + private List nodeGroupSpecs; + + /** + * Creates an instance of MongoClusterUpdateProperties class. + */ + public MongoClusterUpdateProperties() { + } + + /** + * Get the administratorLogin property: The administrator's login for the mongo cluster. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: The administrator's login for the mongo cluster. + * + * @param administratorLogin the administratorLogin value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the serverVersion property: The Mongo DB server version. Defaults to the latest available version if not + * specified. + * + * @return the serverVersion value. + */ + public String serverVersion() { + return this.serverVersion; + } + + /** + * Set the serverVersion property: The Mongo DB server version. Defaults to the latest available version if not + * specified. + * + * @param serverVersion the serverVersion value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withServerVersion(String serverVersion) { + this.serverVersion = serverVersion; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public endpoint access is allowed for this mongo cluster. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public endpoint access is allowed for this mongo cluster. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the nodeGroupSpecs property: The list of node group specs in the cluster. + * + * @return the nodeGroupSpecs value. + */ + public List nodeGroupSpecs() { + return this.nodeGroupSpecs; + } + + /** + * Set the nodeGroupSpecs property: The list of node group specs in the cluster. + * + * @param nodeGroupSpecs the nodeGroupSpecs value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withNodeGroupSpecs(List nodeGroupSpecs) { + this.nodeGroupSpecs = nodeGroupSpecs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (nodeGroupSpecs() != null) { + nodeGroupSpecs().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusters.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusters.java new file mode 100644 index 0000000000000..d8fc3cc228d96 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusters.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.mongocluster.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of MongoClusters. + */ +public interface MongoClusters { + /** + * Check if mongo cluster name is available for use. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability 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 check availability result along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse(String location, + CheckNameAvailabilityRequest body, Context context); + + /** + * Check if mongo cluster name is available for use. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability 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 check availability result. + */ + CheckNameAvailabilityResponse checkNameAvailability(String location, CheckNameAvailabilityRequest body); + + /** + * List all the mongo clusters in a 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 the response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List all the mongo clusters in a given subscription. + * + * @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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the mongo clusters in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets information about a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 information about a mongo cluster along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String mongoClusterName, + Context context); + + /** + * Gets information about a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 information about a mongo cluster. + */ + MongoCluster getByResourceGroup(String resourceGroupName, String mongoClusterName); + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 deleteByResourceGroup(String resourceGroupName, String mongoClusterName); + + /** + * Deletes a mongo cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 mongoClusterName, Context context); + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 connection strings for the given mongo cluster along with {@link Response}. + */ + Response listConnectionStringsWithResponse(String resourceGroupName, + String mongoClusterName, Context context); + + /** + * List mongo cluster connection strings. This includes the default connection string using SCRAM-SHA-256, as well + * as other connection strings supported by the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 connection strings for the given mongo cluster. + */ + ListConnectionStringsResult listConnectionStrings(String resourceGroupName, String mongoClusterName); + + /** + * Gets information about a mongo cluster. + * + * @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 information about a mongo cluster along with {@link Response}. + */ + MongoCluster getById(String id); + + /** + * Gets information about a mongo cluster. + * + * @param id the resource ID. + * @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 information about a mongo cluster along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a mongo cluster. + * + * @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 mongo cluster. + * + * @param id the resource ID. + * @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, Context context); + + /** + * Begins definition for a new MongoCluster resource. + * + * @param name resource name. + * @return the first stage of the new MongoCluster definition. + */ + MongoCluster.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java new file mode 100644 index 0000000000000..afd58dad51ef7 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specification for a node group. + */ +@Fluent +public final class NodeGroupSpec { + /* + * The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. Example values: 'M30', 'M40'. + */ + @JsonProperty(value = "sku") + private String sku; + + /* + * The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. + */ + @JsonProperty(value = "diskSizeGB") + private Long diskSizeGB; + + /* + * Whether high availability is enabled on the node group. + */ + @JsonProperty(value = "enableHa") + private Boolean enableHa; + + /* + * The node type deployed in the node group. + */ + @JsonProperty(value = "kind") + private NodeKind kind; + + /* + * The number of nodes in the node group. + */ + @JsonProperty(value = "nodeCount") + private Integer nodeCount; + + /** + * Creates an instance of NodeGroupSpec class. + */ + public NodeGroupSpec() { + } + + /** + * Get the sku property: The resource sku for the node group. This defines the size of CPU and memory that is + * provisioned for each node. Example values: 'M30', 'M40'. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: The resource sku for the node group. This defines the size of CPU and memory that is + * provisioned for each node. Example values: 'M30', 'M40'. + * + * @param sku the sku value to set. + * @return the NodeGroupSpec object itself. + */ + public NodeGroupSpec withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the diskSizeGB property: The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. + * + * @return the diskSizeGB value. + */ + public Long diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the NodeGroupSpec object itself. + */ + public NodeGroupSpec withDiskSizeGB(Long diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the enableHa property: Whether high availability is enabled on the node group. + * + * @return the enableHa value. + */ + public Boolean enableHa() { + return this.enableHa; + } + + /** + * Set the enableHa property: Whether high availability is enabled on the node group. + * + * @param enableHa the enableHa value to set. + * @return the NodeGroupSpec object itself. + */ + public NodeGroupSpec withEnableHa(Boolean enableHa) { + this.enableHa = enableHa; + return this; + } + + /** + * Get the kind property: The node type deployed in the node group. + * + * @return the kind value. + */ + public NodeKind kind() { + return this.kind; + } + + /** + * Set the kind property: The node type deployed in the node group. + * + * @param kind the kind value to set. + * @return the NodeGroupSpec object itself. + */ + public NodeGroupSpec withKind(NodeKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the nodeCount property: The number of nodes in the node group. + * + * @return the nodeCount value. + */ + public Integer nodeCount() { + return this.nodeCount; + } + + /** + * Set the nodeCount property: The number of nodes in the node group. + * + * @param nodeCount the nodeCount value to set. + * @return the NodeGroupSpec object itself. + */ + public NodeGroupSpec withNodeCount(Integer nodeCount) { + this.nodeCount = nodeCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java new file mode 100644 index 0000000000000..0dfdf88594f57 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The kind of the node on the cluster. + */ +public final class NodeKind extends ExpandableStringEnum { + /** + * Static value Shard for NodeKind. + */ + public static final NodeKind SHARD = fromString("Shard"); + + /** + * Creates a new instance of NodeKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NodeKind() { + } + + /** + * Creates or finds a NodeKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding NodeKind. + */ + @JsonCreator + public static NodeKind fromString(String name) { + return fromString(name, NodeKind.class); + } + + /** + * Gets known NodeKind values. + * + * @return known NodeKind values. + */ + public static Collection values() { + return values(NodeKind.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operation.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operation.java new file mode 100644 index 0000000000000..cd684886d7506 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operation.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.mongocluster.models; + +import com.azure.resourcemanager.mongocluster.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.mongocluster.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationDisplay.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationDisplay.java new file mode 100644 index 0000000000000..a3549a8f631d2 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationDisplay.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.mongocluster.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationListResult.java new file mode 100644 index 0000000000000..42287f8b4cc4f --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationListResult.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mongocluster.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are 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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operations.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operations.java new file mode 100644 index 0000000000000..1b5aacdf9a3b4 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operations.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.mongocluster.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Origin.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Origin.java new file mode 100644 index 0000000000000..1afc16861f67e --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Origin.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.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpoint.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpoint.java new file mode 100644 index 0000000000000..0bdee008b72d9 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpoint.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The private endpoint resource. + */ +@Immutable +public final class PrivateEndpoint { + /* + * The ARM identifier for private endpoint. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Creates an instance of PrivateEndpoint class. + */ + public PrivateEndpoint() { + } + + /** + * Get the id property: The ARM identifier for private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..40dd3f2ee09e4 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProperties.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.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Properties of the private endpoint connection. + */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * The group ids for the private endpoint resource. + */ + @JsonProperty(value = "groupIds", access = JsonProperty.Access.WRITE_ONLY) + private List groupIds; + + /* + * The private endpoint resource. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + @JsonProperty(value = "privateLinkServiceConnectionState", required = true) + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the groupIds property: The group ids for the private endpoint resource. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Get the privateEndpoint property: The private endpoint resource. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The private endpoint resource. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionProperties.class); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProvisioningState.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 0000000000000..6d633614138bf --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The current provisioning state. + */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** + * Static value Succeeded for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Creating for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** + * Static value Deleting for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Failed for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of PrivateEndpointConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointConnectionProvisioningState() { + } + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + @JsonCreator + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** + * Gets known PrivateEndpointConnectionProvisioningState values. + * + * @return known PrivateEndpointConnectionProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResource.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResource.java new file mode 100644 index 0000000000000..5660e9539ae3d --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResource.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner; + +/** + * An immutable client-side representation of PrivateEndpointConnectionResource. + */ +public interface PrivateEndpointConnectionResource { + /** + * 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: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PrivateEndpointConnectionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner + * object. + * + * @return the inner object. + */ + PrivateEndpointConnectionResourceInner innerModel(); + + /** + * The entirety of the PrivateEndpointConnectionResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The PrivateEndpointConnectionResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the PrivateEndpointConnectionResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the PrivateEndpointConnectionResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, mongoClusterName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @return the next definition stage. + */ + WithCreate withExistingMongoCluster(String resourceGroupName, String mongoClusterName); + } + + /** + * The stage of the PrivateEndpointConnectionResource 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnectionResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnectionResource create(Context context); + } + + /** + * The stage of the PrivateEndpointConnectionResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(PrivateEndpointConnectionProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnectionResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnectionResource refresh(Context context); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResourceListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResourceListResult.java new file mode 100644 index 0000000000000..43034ebb46d7c --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResourceListResult.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.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a PrivateEndpointConnectionResource list operation. + */ +@Fluent +public final class PrivateEndpointConnectionResourceListResult { + /* + * The PrivateEndpointConnectionResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Creates an instance of PrivateEndpointConnectionResourceListResult class. + */ + public PrivateEndpointConnectionResourceListResult() { + } + + /** + * Get the value property: The PrivateEndpointConnectionResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The PrivateEndpointConnectionResource items on this page. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionResourceListResult object itself. + */ + public PrivateEndpointConnectionResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the PrivateEndpointConnectionResourceListResult object itself. + */ + public PrivateEndpointConnectionResourceListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model PrivateEndpointConnectionResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionResourceListResult.class); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnections.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..25fd6289efa45 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnections.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of PrivateEndpointConnections. + */ +public interface PrivateEndpointConnections { + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByMongoCluster(String resourceGroupName, + String mongoClusterName); + + /** + * List existing private connections. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateEndpointConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByMongoCluster(String resourceGroupName, + String mongoClusterName, Context context); + + /** + * Get a specific private connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 specific private connection along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName, Context context); + + /** + * Get a specific private connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 specific private connection. + */ + PrivateEndpointConnectionResource get(String resourceGroupName, String mongoClusterName, + String privateEndpointConnectionName); + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, String privateEndpointConnectionName); + + /** + * Delete the private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @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 mongoClusterName, String privateEndpointConnectionName, + Context context); + + /** + * Get a specific private connection. + * + * @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 a specific private connection along with {@link Response}. + */ + PrivateEndpointConnectionResource getById(String id); + + /** + * Get a specific private connection. + * + * @param id the resource ID. + * @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 specific private connection along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete the private endpoint connection. + * + * @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); + + /** + * Delete the private endpoint connection. + * + * @param id the resource ID. + * @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, Context context); + + /** + * Begins definition for a new PrivateEndpointConnectionResource resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnectionResource definition. + */ + PrivateEndpointConnectionResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointServiceConnectionStatus.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 0000000000000..c2eca5fbb1635 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointServiceConnectionStatus.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.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The private endpoint connection status. + */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** + * Static value Pending for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** + * Static value Approved for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of PrivateEndpointServiceConnectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointServiceConnectionStatus() { + } + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + @JsonCreator + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** + * Gets known PrivateEndpointServiceConnectionStatus values. + * + * @return known PrivateEndpointServiceConnectionStatus values. + */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResource.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..bb021b934de0e --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongocluster.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: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.mongocluster.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..30e73bbd84d03 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceListResult.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.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mongocluster.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a PrivateLinkResource list operation. + */ +@Fluent +public final class PrivateLinkResourceListResult { + /* + * The PrivateLinkResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Creates an instance of PrivateLinkResourceListResult class. + */ + public PrivateLinkResourceListResult() { + } + + /** + * Get the value property: The PrivateLinkResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The PrivateLinkResource items on this page. + * + * @param value the value value to set. + * @return the PrivateLinkResourceListResult object itself. + */ + public PrivateLinkResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the PrivateLinkResourceListResult object itself. + */ + public PrivateLinkResourceListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model PrivateLinkResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourceListResult.class); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..f8df35f16364c --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Properties of a private link resource. + */ +@Fluent +public final class PrivateLinkResourceProperties { + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource private link DNS zone name. + */ + @JsonProperty(value = "requiredZoneNames") + private List requiredZoneNames; + + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + public PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceProperties object itself. + */ + public PrivateLinkResourceProperties withRequiredZoneNames(List requiredZoneNames) { + this.requiredZoneNames = requiredZoneNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkServiceConnectionState.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..6a0af0c93e04c --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A collection of information about the state of the connection between service consumer and provider. + */ +@Fluent +public final class PrivateLinkServiceConnectionState { + /* + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ + @JsonProperty(value = "status") + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + @JsonProperty(value = "description") + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /** + * Creates an instance of PrivateLinkServiceConnectionState class. + */ + public PrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval/rejection of the connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState 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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinks.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinks.java new file mode 100644 index 0000000000000..58187b36b128a --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinks.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of PrivateLinks. + */ +public interface PrivateLinks { + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName); + + /** + * list private links on the given resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @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 response of a PrivateLinkResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, + Context context); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ProvisioningState.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ProvisioningState.java new file mode 100644 index 0000000000000..344bdd2f54078 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ProvisioningState.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The provisioning state of the last accepted operation. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value InProgress for ProvisioningState. + */ + public static final ProvisioningState IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Dropping for ProvisioningState. + */ + public static final ProvisioningState DROPPING = fromString("Dropping"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PublicNetworkAccess.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..566773ce1e857 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PublicNetworkAccess.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.mongocluster.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Whether or not public endpoint access is allowed for this Mongo cluster. Value is optional and default value is + * 'Enabled'. + */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** + * Static value Enabled for PublicNetworkAccess. + */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** + * Static value Disabled for PublicNetworkAccess. + */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of PublicNetworkAccess value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicNetworkAccess() { + } + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** + * Gets known PublicNetworkAccess values. + * + * @return known PublicNetworkAccess values. + */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/package-info.java new file mode 100644 index 0000000000000..2ad79ee81561e --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/package-info.java @@ -0,0 +1,10 @@ +// 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 MongoClusterManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for + * MongoDB vCore resources including clusters and firewall rules. + */ +package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/package-info.java new file mode 100644 index 0000000000000..b597e092072d9 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/package-info.java @@ -0,0 +1,10 @@ +// 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 MongoClusterManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for + * MongoDB vCore resources including clusters and firewall rules. + */ +package com.azure.resourcemanager.mongocluster; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/module-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/module-info.java new file mode 100644 index 0000000000000..8dde4bd31b6d3 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.mongocluster { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.mongocluster; + exports com.azure.resourcemanager.mongocluster.fluent; + exports com.azure.resourcemanager.mongocluster.fluent.models; + exports com.azure.resourcemanager.mongocluster.models; + opens com.azure.resourcemanager.mongocluster.fluent.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.mongocluster.models to com.azure.core, com.fasterxml.jackson.databind; +} \ No newline at end of file diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/proxy-config.json b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/proxy-config.json new file mode 100644 index 0000000000000..ccc782e461f49 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/proxy-config.json @@ -0,0 +1 @@ +[ [ "com.azure.resourcemanager.mongocluster.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.mongocluster.implementation.MongoClustersClientImpl$MongoClustersService" ], [ "com.azure.resourcemanager.mongocluster.implementation.FirewallRulesClientImpl$FirewallRulesService" ], [ "com.azure.resourcemanager.mongocluster.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService" ], [ "com.azure.resourcemanager.mongocluster.implementation.PrivateLinksClientImpl$PrivateLinksService" ] ] \ No newline at end of file diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/reflect-config.json b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/reflect-config.json new file mode 100644 index 0000000000000..16628a0e1f4b2 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/reflect-config.json @@ -0,0 +1,181 @@ +[ { + "name" : "com.azure.resourcemanager.mongocluster.models.OperationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.fluent.models.OperationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.OperationDisplay", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.fluent.models.CheckNameAvailabilityResponseInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.MongoClusterListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.MongoClusterProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.MongoClusterRestoreParameters", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.NodeGroupSpec", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.AzureResourceManagerPrivateEndpointConnection", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.PrivateEndpoint", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.PrivateLinkServiceConnectionState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.MongoClusterUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.MongoClusterUpdateProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.FirewallRuleListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.fluent.models.FirewallRuleInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.FirewallRuleProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.fluent.models.ListConnectionStringsResultInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.ConnectionString", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionResourceListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.PrivateLinkResourceListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.fluent.models.PrivateLinkResourceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.PrivateLinkResourceProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.Origin", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.ActionType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityReason", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.CreateMode", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.ProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.MongoClusterStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.PublicNetworkAccess", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.NodeKind", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +} ] \ No newline at end of file diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..dbe423b6bd52b --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.generated; + +import com.azure.resourcemanager.mongocluster.models.FirewallRuleProperties; + +/** + * Samples for FirewallRules CreateOrUpdate. + */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleCreate.json + */ + /** + * Sample code: Creates a firewall rule on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void createsAFirewallRuleOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.firewallRules() + .define("rule1") + .withExistingMongoCluster("TestGroup", "myMongoCluster") + .withProperties( + new FirewallRuleProperties().withStartIpAddress("0.0.0.0").withEndIpAddress("255.255.255.255")) + .create(); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesDeleteSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesDeleteSamples.java new file mode 100644 index 0000000000000..2316721f93d5a --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesDeleteSamples.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.mongocluster.generated; + +/** + * Samples for FirewallRules Delete. + */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleDelete.json + */ + /** + * Sample code: Deletes a firewall rule on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void deletesAFirewallRuleOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.firewallRules().delete("TestGroup", "myMongoCluster", "rule1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetSamples.java new file mode 100644 index 0000000000000..ea44a582a45d7 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetSamples.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.mongocluster.generated; + +/** + * Samples for FirewallRules Get. + */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleGet.json + */ + /** + * Sample code: Gets a firewall rule on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + getsAFirewallRuleOnAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.firewallRules() + .getWithResponse("TestGroup", "myMongoCluster", "rule1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterSamples.java new file mode 100644 index 0000000000000..6dee3b3209269 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterSamples.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.mongocluster.generated; + +/** + * Samples for FirewallRules ListByMongoCluster. + */ +public final class FirewallRulesListByMongoClusterSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_FirewallRuleList.json + */ + /** + * Sample code: List the firewall rules on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listTheFirewallRulesOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.firewallRules().listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilitySamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..493a2fe99f2cd --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilitySamples.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.mongocluster.generated; + +import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; + +/** + * Samples for MongoClusters CheckNameAvailability. + */ +public final class MongoClustersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability.json + */ + /** + * Sample code: Checks and confirms the Mongo Cluster name is availability for use. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .checkNameAvailabilityWithResponse("westus2", new CheckNameAvailabilityRequest().withName("newmongocluster") + .withType("Microsoft.DocumentDB/mongoClusters"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_NameAvailability_AlreadyExists.json + */ + /** + * Sample code: Checks and returns that the Mongo Cluster name is already in-use. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void checksAndReturnsThatTheMongoClusterNameIsAlreadyInUse( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .checkNameAvailabilityWithResponse("westus2", + new CheckNameAvailabilityRequest().withName("existingmongocluster") + .withType("Microsoft.DocumentDB/mongoClusters"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCreateOrUpdateSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..2c513d752e7c0 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCreateOrUpdateSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.generated; + +import com.azure.resourcemanager.mongocluster.models.CreateMode; +import com.azure.resourcemanager.mongocluster.models.MongoClusterProperties; +import com.azure.resourcemanager.mongocluster.models.MongoClusterRestoreParameters; +import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; +import com.azure.resourcemanager.mongocluster.models.NodeKind; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for MongoClusters CreateOrUpdate. + */ +public final class MongoClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_CreatePITR.json + */ + /** + * Sample code: Creates a Mongo Cluster resource from a point in time restore. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void createsAMongoClusterResourceFromAPointInTimeRestore( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .define("myMongoCluster") + .withRegion("westus2") + .withExistingResourceGroup("TestResourceGroup") + .withProperties(new MongoClusterProperties().withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withRestoreParameters(new MongoClusterRestoreParameters() + .withPointInTimeUtc(OffsetDateTime.parse("2023-01-13T20:07:35Z")) + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster"))) + .create(); + } + + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Create.json + */ + /** + * Sample code: Creates a new Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + createsANewMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .define("myMongoCluster") + .withRegion("westus2") + .withExistingResourceGroup("TestResourceGroup") + .withProperties(new MongoClusterProperties().withAdministratorLogin("mongoAdmin") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withServerVersion("5.0") + .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withSku("M30") + .withDiskSizeGB(128L) + .withEnableHa(true) + .withKind(NodeKind.SHARD) + .withNodeCount(1)))) + .create(); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.java new file mode 100644 index 0000000000000..ad32177822589 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.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.mongocluster.generated; + +/** + * Samples for MongoClusters Delete. + */ +public final class MongoClustersDeleteSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Delete.json + */ + /** + * Sample code: Deletes a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + deletesAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters().delete("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersGetByResourceGroupSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..716d8248a440b --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersGetByResourceGroupSamples.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.mongocluster.generated; + +/** + * Samples for MongoClusters GetByResourceGroup. + */ +public final class MongoClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Get.json + */ + /** + * Sample code: Gets a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void getsAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListByResourceGroupSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..6362fd907e463 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListByResourceGroupSamples.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.mongocluster.generated; + +/** + * Samples for MongoClusters ListByResourceGroup. + */ +public final class MongoClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListByResourceGroup.json + */ + /** + * Sample code: Lists the Mongo Cluster resources in a resource group. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listsTheMongoClusterResourcesInAResourceGroup( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters().listByResourceGroup("TestResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsSamples.java new file mode 100644 index 0000000000000..a2e4d89a7a51e --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsSamples.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.mongocluster.generated; + +/** + * Samples for MongoClusters ListConnectionStrings. + */ +public final class MongoClustersListConnectionStringsSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_ListConnectionStrings.json + */ + /** + * Sample code: List the available connection strings for the Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listTheAvailableConnectionStringsForTheMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .listConnectionStringsWithResponse("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListSamples.java new file mode 100644 index 0000000000000..ce25a1dae02fd --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListSamples.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.mongocluster.generated; + +/** + * Samples for MongoClusters List. + */ +public final class MongoClustersListSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_List.json + */ + /** + * Sample code: Lists the Mongo Cluster resources in a subscription. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listsTheMongoClusterResourcesInASubscription( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.mongoClusters().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersUpdateSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersUpdateSamples.java new file mode 100644 index 0000000000000..9baec7add4683 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersUpdateSamples.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.generated; + +import com.azure.resourcemanager.mongocluster.models.MongoCluster; +import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdateProperties; +import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; +import com.azure.resourcemanager.mongocluster.models.NodeKind; +import com.azure.resourcemanager.mongocluster.models.PublicNetworkAccess; +import java.util.Arrays; + +/** + * Samples for MongoClusters Update. + */ +public final class MongoClustersUpdateSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchDiskSize.json + */ + /** + * Sample code: Updates the disk size on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + updatesTheDiskSizeOnAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties() + .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withDiskSizeGB(256L).withKind(NodeKind.SHARD)))) + .apply(); + } + + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PatchPrivateNetworkAccess.json + */ + /** + * Sample code: Disables public network access on a Mongo Cluster resource with a private endpoint connection. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties().withPublicNetworkAccess(PublicNetworkAccess.DISABLED)) + .apply(); + } + + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_Update.json + */ + /** + * Sample code: Updates a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + updatesAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties().withAdministratorLogin("mongoAdmin") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withServerVersion("5.0") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withSku("M50") + .withDiskSizeGB(256L) + .withEnableHa(true) + .withKind(NodeKind.SHARD) + .withNodeCount(1)))) + .apply(); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..3e2f06bade999 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void operationsList(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateSamples.java new file mode 100644 index 0000000000000..dc06f7769b539 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.generated; + +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.mongocluster.models.PrivateLinkServiceConnectionState; + +/** + * Samples for PrivateEndpointConnections Create. + */ +public final class PrivateEndpointConnectionsCreateSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionPut.json + */ + /** + * Sample code: Approves a private endpoint connection on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void approvesAPrivateEndpointConnectionOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateEndpointConnections() + .define("pecTest") + .withExistingMongoCluster("TestGroup", "myMongoCluster") + .withProperties(new PrivateEndpointConnectionProperties().withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Auto-Approved"))) + .create(); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..9e9af7d3bc807 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/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.mongocluster.generated; + +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Delete a private endpoint connection on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void deleteAPrivateEndpointConnectionOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateEndpointConnections() + .delete("TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..7b3b764bbab17 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/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.mongocluster.generated; + +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Get a private endpoint connection on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void getAPrivateEndpointConnectionOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateEndpointConnections() + .getWithResponse("TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java new file mode 100644 index 0000000000000..688237b4f39e3 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterSamples.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.mongocluster.generated; + +/** + * Samples for PrivateEndpointConnections ListByMongoCluster. + */ +public final class PrivateEndpointConnectionsListByMongoClusterSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateEndpointConnectionList.json + */ + /** + * Sample code: Lists the private endpoint connection resources on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listsThePrivateEndpointConnectionResourcesOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateEndpointConnections() + .listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterSamples.java new file mode 100644 index 0000000000000..4a8ae076d3347 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterSamples.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.mongocluster.generated; + +/** + * Samples for PrivateLinks ListByMongoCluster. + */ +public final class PrivateLinksListByMongoClusterSamples { + /* + * x-ms-original-file: specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-03-01-preview/examples/MongoClusters_PrivateLinkResourceList.json + */ + /** + * Sample code: Lists the private link resources available on a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listsThePrivateLinkResourcesAvailableOnAMongoClusterResource( + com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + manager.privateLinks().listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/ci.yml b/sdk/mongocluster/ci.yml new file mode 100644 index 0000000000000..aaa5cd15a353b --- /dev/null +++ b/sdk/mongocluster/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/mongocluster/ci.yml + - sdk/mongocluster/azure-resourcemanager-mongocluster/ + exclude: + - sdk/mongocluster/pom.xml + - sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mongocluster/ci.yml + - sdk/mongocluster/azure-resourcemanager-mongocluster/ + exclude: + - sdk/mongocluster/pom.xml + - sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml + +parameters: + - name: release_azureresourcemanagermongocluster + displayName: azure-resourcemanager-mongocluster + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: mongocluster + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-mongocluster + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermongocluster + releaseInBatch: ${{ parameters.release_azureresourcemanagermongocluster }} diff --git a/sdk/mongocluster/pom.xml b/sdk/mongocluster/pom.xml new file mode 100644 index 0000000000000..f985b8cc6cafa --- /dev/null +++ b/sdk/mongocluster/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-mongocluster-service + pom + 1.0.0 + + + azure-resourcemanager-mongocluster + +