From 60bd087c73643717c711139c4f3253957a049582 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 15 Aug 2024 06:48:24 +0000 Subject: [PATCH] CodeGen from PR 3476 in test-repo-billy/azure-rest-api-specs Merge 87a65231022d88d933ce8ff503d71b39c96bc42b into 7287b054bc3863f8fe7c1e3818243277440694e4 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 104 + .../SAMPLE.md | 724 +++++++ .../pom.xml | 67 + .../mongoclustertest/MongoClusterManager.java | 357 ++++ .../fluent/FirewallRulesClient.java | 201 ++ .../fluent/MongoClusterManagementClient.java | 90 + .../fluent/MongoClustersClient.java | 397 ++++ .../fluent/OperationsClient.java | 40 + .../PrivateEndpointConnectionsClient.java | 220 ++ .../fluent/PrivateLinksClient.java | 44 + .../fluent/ReplicasClient.java | 43 + .../CheckNameAvailabilityResponseInner.java | 153 ++ .../fluent/models/FirewallRuleInner.java | 166 ++ .../ListConnectionStringsResultInner.java | 89 + .../fluent/models/MongoClusterInner.java | 192 ++ .../fluent/models/OperationInner.java | 172 ++ ...rivateEndpointConnectionResourceInner.java | 168 ++ .../models/PrivateLinkResourceInner.java | 166 ++ .../fluent/models/ReplicaInner.java | 166 ++ .../fluent/models/package-info.java | 10 + .../mongoclustertest/fluent/package-info.java | 10 + .../CheckNameAvailabilityResponseImpl.java | 41 + .../implementation/FirewallRuleImpl.java | 129 ++ .../FirewallRulesClientImpl.java | 944 +++++++++ .../implementation/FirewallRulesImpl.java | 159 ++ .../ListConnectionStringsResultImpl.java | 40 + .../implementation/MongoClusterImpl.java | 203 ++ .../MongoClusterManagementClientBuilder.java | 138 ++ .../MongoClusterManagementClientImpl.java | 368 ++++ .../MongoClustersClientImpl.java | 1816 +++++++++++++++++ .../implementation/MongoClustersImpl.java | 204 ++ .../implementation/OperationImpl.java | 51 + .../implementation/OperationsClientImpl.java | 235 +++ .../implementation/OperationsImpl.java | 45 + ...PrivateEndpointConnectionResourceImpl.java | 108 + .../PrivateEndpointConnectionsClientImpl.java | 999 +++++++++ .../PrivateEndpointConnectionsImpl.java | 170 ++ .../PrivateLinkResourceImpl.java | 50 + .../PrivateLinksClientImpl.java | 286 +++ .../implementation/PrivateLinksImpl.java | 48 + .../implementation/ReplicaImpl.java | 50 + .../implementation/ReplicasClientImpl.java | 281 +++ .../implementation/ReplicasImpl.java | 46 + .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/package-info.java | 10 + .../mongoclustertest/models/ActionType.java | 46 + .../models/CheckNameAvailabilityReason.java | 51 + .../models/CheckNameAvailabilityRequest.java | 121 ++ .../models/CheckNameAvailabilityResponse.java | 41 + .../models/ConnectionString.java | 97 + .../mongoclustertest/models/CreateMode.java | 61 + .../mongoclustertest/models/FirewallRule.java | 189 ++ .../models/FirewallRuleListResult.java | 134 ++ .../models/FirewallRuleProperties.java | 152 ++ .../models/FirewallRules.java | 144 ++ .../models/ListConnectionStringsResult.java | 27 + .../mongoclustertest/models/MongoCluster.java | 309 +++ .../models/MongoClusterListResult.java | 134 ++ .../models/MongoClusterProperties.java | 460 +++++ .../models/MongoClusterReplicaParameters.java | 136 ++ .../models/MongoClusterRestoreParameters.java | 127 ++ .../models/MongoClusterStatus.java | 76 + .../models/MongoClusterUpdate.java | 126 ++ .../models/MongoClusterUpdateProperties.java | 246 +++ .../models/MongoClusters.java | 237 +++ .../models/NodeGroupSpec.java | 208 ++ .../mongoclustertest/models/NodeKind.java | 46 + .../mongoclustertest/models/Operation.java | 58 + .../models/OperationDisplay.java | 136 ++ .../models/OperationListResult.java | 104 + .../mongoclustertest/models/Operations.java | 35 + .../mongoclustertest/models/Origin.java | 57 + .../models/PreviewFeature.java | 46 + .../models/PrivateEndpoint.java | 81 + .../models/PrivateEndpointConnection.java | 166 ++ .../PrivateEndpointConnectionProperties.java | 176 ++ ...teEndpointConnectionProvisioningState.java | 62 + .../PrivateEndpointConnectionResource.java | 138 ++ ...eEndpointConnectionResourceListResult.java | 138 ++ .../models/PrivateEndpointConnections.java | 154 ++ ...rivateEndpointServiceConnectionStatus.java | 57 + .../models/PrivateLinkResource.java | 55 + .../models/PrivateLinkResourceListResult.java | 137 ++ .../models/PrivateLinkResourceProperties.java | 130 ++ .../PrivateLinkServiceConnectionState.java | 155 ++ .../mongoclustertest/models/PrivateLinks.java | 39 + .../mongoclustertest/models/PromoteMode.java | 46 + .../models/PromoteOption.java | 46 + .../models/PromoteReplicaRequest.java | 132 ++ .../models/ProvisioningState.java | 71 + .../models/PublicNetworkAccess.java | 52 + .../mongoclustertest/models/Replica.java | 55 + .../models/ReplicaListResult.java | 134 ++ .../mongoclustertest/models/Replicas.java | 38 + .../models/ReplicationProperties.java | 114 ++ .../models/ReplicationRole.java | 56 + .../models/ReplicationState.java | 71 + .../mongoclustertest/models/package-info.java | 10 + .../mongoclustertest/package-info.java | 10 + .../src/main/java/module-info.java | 13 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../FirewallRulesCreateOrUpdateSamples.java | 32 + .../generated/FirewallRulesDeleteSamples.java | 25 + .../generated/FirewallRulesGetSamples.java | 26 + ...irewallRulesListByMongoClusterSamples.java | 25 + ...oClustersCheckNameAvailabilitySamples.java | 48 + .../MongoClustersCreateOrUpdateSamples.java | 93 + .../generated/MongoClustersDeleteSamples.java | 25 + ...ongoClustersGetByResourceGroupSamples.java | 26 + ...ngoClustersListByResourceGroupSamples.java | 25 + ...oClustersListConnectionStringsSamples.java | 26 + .../generated/MongoClustersListSamples.java | 25 + .../MongoClustersPromoteSamples.java | 32 + .../generated/MongoClustersUpdateSamples.java | 107 + .../generated/OperationsListSamples.java | 24 + ...ivateEndpointConnectionsCreateSamples.java | 35 + ...ivateEndpointConnectionsDeleteSamples.java | 27 + .../PrivateEndpointConnectionsGetSamples.java | 27 + ...tConnectionsListByMongoClusterSamples.java | 26 + ...PrivateLinksListByMongoClusterSamples.java | 25 + .../ReplicasListByParentSamples.java | 25 + sdk/mongoclustertest/ci.yml | 46 + sdk/mongoclustertest/pom.xml | 15 + 127 files changed, 16912 insertions(+) create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/CHANGELOG.md create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/README.md create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/SAMPLE.md create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/pom.xml create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/MongoClusterManager.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/FirewallRulesClient.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/MongoClusterManagementClient.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/MongoClustersClient.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/OperationsClient.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/PrivateEndpointConnectionsClient.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/PrivateLinksClient.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/ReplicasClient.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/CheckNameAvailabilityResponseInner.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/FirewallRuleInner.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/ListConnectionStringsResultInner.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/MongoClusterInner.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/OperationInner.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/PrivateEndpointConnectionResourceInner.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/PrivateLinkResourceInner.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/ReplicaInner.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/package-info.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/package-info.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRuleImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRulesClientImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRulesImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ListConnectionStringsResultImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterManagementClientBuilder.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterManagementClientImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClustersClientImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClustersImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationsClientImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationsImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionResourceImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinkResourceImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinksClientImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinksImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicaImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicasClientImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicasImpl.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ResourceManagerUtils.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/package-info.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ActionType.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityReason.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityRequest.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityResponse.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ConnectionString.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CreateMode.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRule.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRuleListResult.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRuleProperties.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRules.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ListConnectionStringsResult.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoCluster.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterListResult.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterProperties.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterReplicaParameters.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterRestoreParameters.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterStatus.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterUpdate.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterUpdateProperties.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusters.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/NodeGroupSpec.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/NodeKind.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Operation.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/OperationDisplay.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/OperationListResult.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Operations.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Origin.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PreviewFeature.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpoint.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnection.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionProperties.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionProvisioningState.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionResource.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionResourceListResult.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnections.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointServiceConnectionStatus.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResource.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResourceListResult.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResourceProperties.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkServiceConnectionState.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinks.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteMode.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteOption.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteReplicaRequest.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ProvisioningState.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PublicNetworkAccess.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Replica.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicaListResult.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Replicas.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationProperties.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationRole.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationState.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/package-info.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/package-info.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/module-info.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongoclustertest/proxy-config.json create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongoclustertest/reflect-config.json create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesCreateOrUpdateSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesDeleteSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesGetSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesListByMongoClusterSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersCheckNameAvailabilitySamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersCreateOrUpdateSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersDeleteSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersGetByResourceGroupSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListByResourceGroupSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListConnectionStringsSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersPromoteSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersUpdateSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/OperationsListSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsCreateSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsDeleteSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsGetSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateLinksListByMongoClusterSamples.java create mode 100644 sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/ReplicasListByParentSamples.java create mode 100644 sdk/mongoclustertest/ci.yml create mode 100644 sdk/mongoclustertest/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8c86a0e22b625..2a372f262e635 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -468,6 +468,7 @@ com.azure.resourcemanager:azure-resourcemanager-mongocluster;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-computefleet;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-servicefabricmanagedclusters;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthdataaiservices;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-mongoclustertest;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 24c4975f99521..1bcbb05b198f4 100644 --- a/pom.xml +++ b/pom.xml @@ -140,6 +140,7 @@ sdk/mobilenetwork sdk/modelsrepository sdk/mongocluster + sdk/mongoclustertest sdk/monitor sdk/mysql sdk/mysqlflexibleserver diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/CHANGELOG.md b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/CHANGELOG.md new file mode 100644 index 0000000000000..84d3b03e31a84 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2024-08-15) + +- Azure Resource Manager Mongo Cluster client library for Java. This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. 111 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-06-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-mongoclustertest Java SDK. diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/README.md b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/README.md new file mode 100644 index 0000000000000..3dc863a229b31 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/README.md @@ -0,0 +1,104 @@ +# 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. 111 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-06-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-mongoclustertest;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-mongoclustertest + 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 + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the 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/mongoclustertest/azure-resourcemanager-mongoclustertest/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_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[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%2Fmongoclustertest%2Fazure-resourcemanager-mongoclustertest%2FREADME.png) diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/SAMPLE.md b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/SAMPLE.md new file mode 100644 index 0000000000000..fa7ee37670257 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/SAMPLE.md @@ -0,0 +1,724 @@ +# 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) +- [Promote](#mongoclusters_promote) +- [Update](#mongoclusters_update) + +## Operations + +- [List](#operations_list) + +## PrivateEndpointConnections + +- [Create](#privateendpointconnections_create) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByMongoCluster](#privateendpointconnections_listbymongocluster) + +## PrivateLinks + +- [ListByMongoCluster](#privatelinks_listbymongocluster) + +## Replicas + +- [ListByParent](#replicas_listbyparent) +### FirewallRules_CreateOrUpdate + +```java +import com.azure.resourcemanager.mongoclustertest.models.FirewallRuleProperties; + +/** + * Samples for FirewallRules CreateOrUpdate. + */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.firewallRules().listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_CheckNameAvailability + +```java +import com.azure.resourcemanager.mongoclustertest.models.CheckNameAvailabilityRequest; + +/** + * Samples for MongoClusters CheckNameAvailability. + */ +public final class MongoClustersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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.mongoclustertest.models.CreateMode; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterProperties; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterReplicaParameters; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterRestoreParameters; +import com.azure.resourcemanager.mongoclustertest.models.NodeGroupSpec; +import com.azure.resourcemanager.mongoclustertest.models.NodeKind; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for MongoClusters CreateOrUpdate. + */ +public final class MongoClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_CreateGeoReplica.json + */ + /** + * Sample code: Creates a replica Mongo Cluster resource from a source resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void createsAReplicaMongoClusterResourceFromASourceResource( + com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters() + .define("myReplicaMongoCluster") + .withRegion("centralus") + .withExistingResourceGroup("TestResourceGroup") + .withProperties(new MongoClusterProperties().withCreateMode(CreateMode.GEO_REPLICA) + .withReplicaParameters(new MongoClusterReplicaParameters().withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster") + .withSourceLocation("eastus"))) + .create(); + } + + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters() + .listConnectionStringsWithResponse("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_Promote + +```java +import com.azure.resourcemanager.mongoclustertest.models.PromoteMode; +import com.azure.resourcemanager.mongoclustertest.models.PromoteOption; +import com.azure.resourcemanager.mongoclustertest.models.PromoteReplicaRequest; + +/** + * Samples for MongoClusters Promote. + */ +public final class MongoClustersPromoteSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_ForcePromoteReplica.json + */ + /** + * Sample code: Promotes a replica Mongo Cluster resource to a primary role. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void promotesAReplicaMongoClusterResourceToAPrimaryRole( + com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters() + .promote("TestGroup", "myMongoCluster", + new PromoteReplicaRequest().withPromoteOption(PromoteOption.FORCED).withMode(PromoteMode.SWITCHOVER), + com.azure.core.util.Context.NONE); + } +} +``` + +### MongoClusters_Update + +```java +import com.azure.resourcemanager.mongoclustertest.models.MongoCluster; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterUpdateProperties; +import com.azure.resourcemanager.mongoclustertest.models.NodeGroupSpec; +import com.azure.resourcemanager.mongoclustertest.models.NodeKind; +import com.azure.resourcemanager.mongoclustertest.models.PublicNetworkAccess; +import java.util.Arrays; + +/** + * Samples for MongoClusters Update. + */ +public final class MongoClustersUpdateSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_ResetPassword.json + */ + /** + * Sample code: Resets the administrator login password. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + resetsTheAdministratorLoginPassword(com.azure.resourcemanager.mongoclustertest.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")) + .apply(); + } + + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void operationsList(com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Create + +```java +import com.azure.resourcemanager.mongoclustertest.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.mongoclustertest.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.mongoclustertest.models.PrivateLinkServiceConnectionState; + +/** + * Samples for PrivateEndpointConnections Create. + */ +public final class PrivateEndpointConnectionsCreateSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.privateLinks().listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + +### Replicas_ListByParent + +```java +/** + * Samples for Replicas ListByParent. + */ +public final class ReplicasListByParentSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_ReplicaList.json + */ + /** + * Sample code: List the replicas linked to a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listTheReplicasLinkedToAMongoClusterResource( + com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager) { + manager.replicas().listByParent("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/pom.xml b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/pom.xml new file mode 100644 index 0000000000000..ecf6510b7723c --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-mongoclustertest + 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. 111 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-06-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-json + 1.2.0 + + + com.azure + azure-core + 1.51.0 + + + com.azure + azure-core-management + 1.15.2 + + + diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/MongoClusterManager.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/MongoClusterManager.java new file mode 100644 index 0000000000000..e0e3180564619 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/MongoClusterManager.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest; + +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.mongoclustertest.fluent.MongoClusterManagementClient; +import com.azure.resourcemanager.mongoclustertest.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.mongoclustertest.implementation.MongoClusterManagementClientBuilder; +import com.azure.resourcemanager.mongoclustertest.implementation.MongoClustersImpl; +import com.azure.resourcemanager.mongoclustertest.implementation.OperationsImpl; +import com.azure.resourcemanager.mongoclustertest.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.mongoclustertest.implementation.PrivateLinksImpl; +import com.azure.resourcemanager.mongoclustertest.implementation.ReplicasImpl; +import com.azure.resourcemanager.mongoclustertest.models.FirewallRules; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusters; +import com.azure.resourcemanager.mongoclustertest.models.Operations; +import com.azure.resourcemanager.mongoclustertest.models.PrivateEndpointConnections; +import com.azure.resourcemanager.mongoclustertest.models.PrivateLinks; +import com.azure.resourcemanager.mongoclustertest.models.Replicas; +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. + * 111 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 Replicas replicas; + + 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.mongoclustertest") + .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 the resource collection API of Replicas. + * + * @return Resource collection API of Replicas. + */ + public Replicas replicas() { + if (this.replicas == null) { + this.replicas = new ReplicasImpl(clientObject.getReplicas(), this); + } + return replicas; + } + + /** + * 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/FirewallRulesClient.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/FirewallRulesClient.java new file mode 100644 index 0000000000000..f17fb702b9a51 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/MongoClusterManagementClient.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/MongoClusterManagementClient.java new file mode 100644 index 0000000000000..6b8a83be18992 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/MongoClusterManagementClient.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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(); + + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + ReplicasClient getReplicas(); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/MongoClustersClient.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/MongoClustersClient.java new file mode 100644 index 0000000000000..e3acb489de5bc --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/MongoClustersClient.java @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mongoclustertest.fluent.models.ListConnectionStringsResultInner; +import com.azure.resourcemanager.mongoclustertest.fluent.models.MongoClusterInner; +import com.azure.resourcemanager.mongoclustertest.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterUpdate; +import com.azure.resourcemanager.mongoclustertest.models.PromoteReplicaRequest; + +/** + * 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); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body, Context context); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, Context context); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/OperationsClient.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/OperationsClient.java new file mode 100644 index 0000000000000..e109db5cf5243 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/PrivateEndpointConnectionsClient.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..53744a2238aeb --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/PrivateLinksClient.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/PrivateLinksClient.java new file mode 100644 index 0000000000000..f4638c699b871 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/ReplicasClient.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/ReplicasClient.java new file mode 100644 index 0000000000000..5c690ea262873 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/ReplicasClient.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.mongoclustertest.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.mongoclustertest.fluent.models.ReplicaInner; + +/** + * An instance of this class provides access to all the operations defined in ReplicasClient. + */ +public interface ReplicasClient { + /** + * List all the replicas for the 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 Replica list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceGroupName, String mongoClusterName); + + /** + * List all the replicas for the 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 Replica list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceGroupName, String mongoClusterName, Context context); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..22784863ba98c --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.models.CheckNameAvailabilityReason; +import java.io.IOException; + +/** + * The check availability result. + */ +@Fluent +public final class CheckNameAvailabilityResponseInner implements JsonSerializable { + /* + * Indicates if the resource name is available. + */ + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is available. + */ + 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable); + jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString()); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckNameAvailabilityResponseInner. + */ + public static CheckNameAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityResponseInner deserializedCheckNameAvailabilityResponseInner + = new CheckNameAvailabilityResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.reason + = CheckNameAvailabilityReason.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityResponseInner; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/FirewallRuleInner.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/FirewallRuleInner.java new file mode 100644 index 0000000000000..1a45251ebf74d --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/FirewallRuleInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.models.FirewallRuleProperties; +import java.io.IOException; + +/** + * Represents a mongo cluster firewall rule. + */ +@Fluent +public final class FirewallRuleInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private FirewallRuleProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /* + * The name of the resource. + */ + private String name; + + /* + * The type of the resource. + */ + private String type; + + /** + * 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; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirewallRuleInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirewallRuleInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FirewallRuleInner. + */ + public static FirewallRuleInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirewallRuleInner deserializedFirewallRuleInner = new FirewallRuleInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFirewallRuleInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFirewallRuleInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFirewallRuleInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFirewallRuleInner.properties = FirewallRuleProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFirewallRuleInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFirewallRuleInner; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/ListConnectionStringsResultInner.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/ListConnectionStringsResultInner.java new file mode 100644 index 0000000000000..a022f9e7baa1a --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/ListConnectionStringsResultInner.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.models.ConnectionString; +import java.io.IOException; +import java.util.List; + +/** + * The connection strings for the given mongo cluster. + */ +@Immutable +public final class ListConnectionStringsResultInner implements JsonSerializable { + /* + * An array that contains the connection strings for a mongo cluster. + */ + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListConnectionStringsResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListConnectionStringsResultInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ListConnectionStringsResultInner. + */ + public static ListConnectionStringsResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListConnectionStringsResultInner deserializedListConnectionStringsResultInner + = new ListConnectionStringsResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectionStrings".equals(fieldName)) { + List connectionStrings + = reader.readArray(reader1 -> ConnectionString.fromJson(reader1)); + deserializedListConnectionStringsResultInner.connectionStrings = connectionStrings; + } else { + reader.skipChildren(); + } + } + + return deserializedListConnectionStringsResultInner; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/MongoClusterInner.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/MongoClusterInner.java new file mode 100644 index 0000000000000..e82feb05e4632 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/MongoClusterInner.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Represents a mongo cluster resource. + */ +@Fluent +public final class MongoClusterInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private MongoClusterProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /* + * The name of the resource. + */ + private String name; + + /* + * The type of the resource. + */ + private String type; + + /** + * 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; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * {@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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoClusterInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoClusterInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoClusterInner. + */ + public static MongoClusterInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoClusterInner deserializedMongoClusterInner = new MongoClusterInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMongoClusterInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMongoClusterInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMongoClusterInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMongoClusterInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMongoClusterInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedMongoClusterInner.properties = MongoClusterProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedMongoClusterInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoClusterInner; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/OperationInner.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..542634853d02f --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.models.ActionType; +import com.azure.resourcemanager.mongoclustertest.models.OperationDisplay; +import com.azure.resourcemanager.mongoclustertest.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + 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" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/PrivateEndpointConnectionResourceInner.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/PrivateEndpointConnectionResourceInner.java new file mode 100644 index 0000000000000..28c0efea79f3c --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/PrivateEndpointConnectionResourceInner.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.models.PrivateEndpointConnectionProperties; +import java.io.IOException; + +/** + * 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. + */ + private PrivateEndpointConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /* + * The name of the resource. + */ + private String name; + + /* + * The type of the resource. + */ + private String type; + + /** + * 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; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionResourceInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionResourceInner. + */ + public static PrivateEndpointConnectionResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionResourceInner deserializedPrivateEndpointConnectionResourceInner + = new PrivateEndpointConnectionResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.properties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionResourceInner; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/PrivateLinkResourceInner.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..e5070dade49fe --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.models.PrivateLinkResourceProperties; +import java.io.IOException; + +/** + * 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. + */ + private PrivateLinkResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /* + * The name of the resource. + */ + private String name; + + /* + * The type of the resource. + */ + private String type; + + /** + * 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; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateLinkResourceInner. + */ + public static PrivateLinkResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceInner deserializedPrivateLinkResourceInner = new PrivateLinkResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateLinkResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateLinkResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateLinkResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateLinkResourceInner.properties = PrivateLinkResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateLinkResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceInner; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/ReplicaInner.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/ReplicaInner.java new file mode 100644 index 0000000000000..ecc28a4d6f6b8 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/ReplicaInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterProperties; +import java.io.IOException; + +/** + * Represents a mongo cluster replica. + */ +@Fluent +public final class ReplicaInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private MongoClusterProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /* + * The name of the resource. + */ + private String name; + + /* + * The type of the resource. + */ + private String type; + + /** + * Creates an instance of ReplicaInner class. + */ + public ReplicaInner() { + } + + /** + * 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 ReplicaInner object itself. + */ + public ReplicaInner 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; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ReplicaInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ReplicaInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ReplicaInner. + */ + public static ReplicaInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ReplicaInner deserializedReplicaInner = new ReplicaInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedReplicaInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedReplicaInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedReplicaInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedReplicaInner.properties = MongoClusterProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedReplicaInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedReplicaInner; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/package-info.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/models/package-info.java new file mode 100644 index 0000000000000..f2da619e840c4 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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. + * 111 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.mongoclustertest.fluent.models; diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/package-info.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/fluent/package-info.java new file mode 100644 index 0000000000000..e753c29607c44 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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. + * 111 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.mongoclustertest.fluent; diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..4316c38e1542d --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.implementation; + +import com.azure.resourcemanager.mongoclustertest.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mongoclustertest.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.mongoclustertest.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.mongoclustertest.MongoClusterManager serviceManager; + + CheckNameAvailabilityResponseImpl(CheckNameAvailabilityResponseInner innerObject, + com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRuleImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRuleImpl.java new file mode 100644 index 0000000000000..5ad75bb8042fb --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongoclustertest.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.mongoclustertest.models.FirewallRule; +import com.azure.resourcemanager.mongoclustertest.models.FirewallRuleProperties; + +public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private FirewallRuleInner innerObject; + + private final com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.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.mongoclustertest.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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRulesClientImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRulesClientImpl.java new file mode 100644 index 0000000000000..0f35f6a745ce4 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,944 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.mongoclustertest.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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + * @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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRulesImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/FirewallRulesImpl.java new file mode 100644 index 0000000000000..d790ff50e3af5 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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.mongoclustertest.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.mongoclustertest.models.FirewallRule; +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager serviceManager; + + public FirewallRulesImpl(FirewallRulesClient innerClient, + com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } + + public FirewallRuleImpl define(String name) { + return new FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ListConnectionStringsResultImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ListConnectionStringsResultImpl.java new file mode 100644 index 0000000000000..3d22c77f337bf --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.implementation; + +import com.azure.resourcemanager.mongoclustertest.fluent.models.ListConnectionStringsResultInner; +import com.azure.resourcemanager.mongoclustertest.models.ConnectionString; +import com.azure.resourcemanager.mongoclustertest.models.ListConnectionStringsResult; +import java.util.Collections; +import java.util.List; + +public final class ListConnectionStringsResultImpl implements ListConnectionStringsResult { + private ListConnectionStringsResultInner innerObject; + + private final com.azure.resourcemanager.mongoclustertest.MongoClusterManager serviceManager; + + ListConnectionStringsResultImpl(ListConnectionStringsResultInner innerObject, + com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterImpl.java new file mode 100644 index 0000000000000..cfafa11f05507 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterImpl.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.models.MongoClusterInner; +import com.azure.resourcemanager.mongoclustertest.models.ListConnectionStringsResult; +import com.azure.resourcemanager.mongoclustertest.models.MongoCluster; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterProperties; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterUpdate; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterUpdateProperties; +import com.azure.resourcemanager.mongoclustertest.models.PromoteReplicaRequest; +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.mongoclustertest.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.mongoclustertest.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.mongoclustertest.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.mongoclustertest.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 void promote(PromoteReplicaRequest body) { + serviceManager.mongoClusters().promote(resourceGroupName, mongoClusterName, body); + } + + public void promote(PromoteReplicaRequest body, Context context) { + serviceManager.mongoClusters().promote(resourceGroupName, mongoClusterName, body, context); + } + + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterManagementClientBuilder.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterManagementClientBuilder.java new file mode 100644 index 0000000000000..d5be1c3c90e57 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterManagementClientImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterManagementClientImpl.java new file mode 100644 index 0000000000000..222abfd9e4700 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClusterManagementClientImpl.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mongoclustertest.fluent.MongoClusterManagementClient; +import com.azure.resourcemanager.mongoclustertest.fluent.MongoClustersClient; +import com.azure.resourcemanager.mongoclustertest.fluent.OperationsClient; +import com.azure.resourcemanager.mongoclustertest.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mongoclustertest.fluent.PrivateLinksClient; +import com.azure.resourcemanager.mongoclustertest.fluent.ReplicasClient; +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; + } + + /** + * The ReplicasClient object to access its operations. + */ + private final ReplicasClient replicas; + + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + public ReplicasClient getReplicas() { + return this.replicas; + } + + /** + * 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-06-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); + this.replicas = new ReplicasClientImpl(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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClustersClientImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClustersClientImpl.java new file mode 100644 index 0000000000000..035fda9b81b94 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClustersClientImpl.java @@ -0,0 +1,1816 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.MongoClustersClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mongoclustertest.fluent.models.ListConnectionStringsResultInner; +import com.azure.resourcemanager.mongoclustertest.fluent.models.MongoClusterInner; +import com.azure.resourcemanager.mongoclustertest.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterListResult; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterUpdate; +import com.azure.resourcemanager.mongoclustertest.models.PromoteReplicaRequest; +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" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/promote") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> promote(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, + @BodyParam("application/json") PromoteReplicaRequest body, @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(); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> promoteWithResponseAsync(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest 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 (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 (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.promote(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> promoteWithResponseAsync(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest 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 (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 (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.promote(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, body, accept, context); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPromoteAsync(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body) { + Mono>> mono = promoteWithResponseAsync(resourceGroupName, mongoClusterName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPromoteAsync(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = promoteWithResponseAsync(resourceGroupName, mongoClusterName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body) { + return this.beginPromoteAsync(resourceGroupName, mongoClusterName, body).getSyncPoller(); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body, Context context) { + return this.beginPromoteAsync(resourceGroupName, mongoClusterName, body, context).getSyncPoller(); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono promoteAsync(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body) { + return beginPromoteAsync(resourceGroupName, mongoClusterName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono promoteAsync(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, + Context context) { + return beginPromoteAsync(resourceGroupName, mongoClusterName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body) { + promoteAsync(resourceGroupName, mongoClusterName, body).block(); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, + Context context) { + promoteAsync(resourceGroupName, mongoClusterName, body, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + * @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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClustersImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClustersImpl.java new file mode 100644 index 0000000000000..576264352e590 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/MongoClustersImpl.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.MongoClustersClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.mongoclustertest.fluent.models.ListConnectionStringsResultInner; +import com.azure.resourcemanager.mongoclustertest.fluent.models.MongoClusterInner; +import com.azure.resourcemanager.mongoclustertest.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.mongoclustertest.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.mongoclustertest.models.ListConnectionStringsResult; +import com.azure.resourcemanager.mongoclustertest.models.MongoCluster; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusters; +import com.azure.resourcemanager.mongoclustertest.models.PromoteReplicaRequest; + +public final class MongoClustersImpl implements MongoClusters { + private static final ClientLogger LOGGER = new ClientLogger(MongoClustersImpl.class); + + private final MongoClustersClient innerClient; + + private final com.azure.resourcemanager.mongoclustertest.MongoClusterManager serviceManager; + + public MongoClustersImpl(MongoClustersClient innerClient, + com.azure.resourcemanager.mongoclustertest.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 void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body) { + this.serviceClient().promote(resourceGroupName, mongoClusterName, body); + } + + public void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, + Context context) { + this.serviceClient().promote(resourceGroupName, mongoClusterName, body, context); + } + + 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.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } + + public MongoClusterImpl define(String name) { + return new MongoClusterImpl(name, this.manager()); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationImpl.java new file mode 100644 index 0000000000000..6cf3b9b7d600c --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.implementation; + +import com.azure.resourcemanager.mongoclustertest.fluent.models.OperationInner; +import com.azure.resourcemanager.mongoclustertest.models.ActionType; +import com.azure.resourcemanager.mongoclustertest.models.Operation; +import com.azure.resourcemanager.mongoclustertest.models.OperationDisplay; +import com.azure.resourcemanager.mongoclustertest.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.mongoclustertest.MongoClusterManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationsClientImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..183f66da315b3 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.OperationsClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.OperationInner; +import com.azure.resourcemanager.mongoclustertest.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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + * @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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationsImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..78c541807877b --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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.mongoclustertest.fluent.OperationsClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.OperationInner; +import com.azure.resourcemanager.mongoclustertest.models.Operation; +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionResourceImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionResourceImpl.java new file mode 100644 index 0000000000000..6a28af2cf34a3 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongoclustertest.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.mongoclustertest.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.mongoclustertest.models.PrivateEndpointConnectionResource; + +public final class PrivateEndpointConnectionResourceImpl + implements PrivateEndpointConnectionResource, PrivateEndpointConnectionResource.Definition { + private PrivateEndpointConnectionResourceInner innerObject; + + private final com.azure.resourcemanager.mongoclustertest.MongoClusterManager serviceManager; + + PrivateEndpointConnectionResourceImpl(PrivateEndpointConnectionResourceInner innerObject, + com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..7bcdaa54ec392 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,999 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.mongoclustertest.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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + * @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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionsImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..35add445bb976 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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.mongoclustertest.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.mongoclustertest.models.PrivateEndpointConnectionResource; +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionResourceImpl define(String name) { + return new PrivateEndpointConnectionResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinkResourceImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..cd7c311294452 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongoclustertest.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mongoclustertest.models.PrivateLinkResource; +import com.azure.resourcemanager.mongoclustertest.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.mongoclustertest.MongoClusterManager serviceManager; + + PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinksClientImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinksClientImpl.java new file mode 100644 index 0000000000000..4783ebaed56dd --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinksClientImpl.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.PrivateLinksClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mongoclustertest.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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + * @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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinksImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/PrivateLinksImpl.java new file mode 100644 index 0000000000000..9aea4dd3285e9 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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.mongoclustertest.fluent.PrivateLinksClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mongoclustertest.models.PrivateLinkResource; +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager serviceManager; + + public PrivateLinksImpl(PrivateLinksClient innerClient, + com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicaImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicaImpl.java new file mode 100644 index 0000000000000..9c1b1bac4a57d --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicaImpl.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.mongoclustertest.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongoclustertest.fluent.models.ReplicaInner; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterProperties; +import com.azure.resourcemanager.mongoclustertest.models.Replica; + +public final class ReplicaImpl implements Replica { + private ReplicaInner innerObject; + + private final com.azure.resourcemanager.mongoclustertest.MongoClusterManager serviceManager; + + ReplicaImpl(ReplicaInner innerObject, + com.azure.resourcemanager.mongoclustertest.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 MongoClusterProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ReplicaInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicasClientImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicasClientImpl.java new file mode 100644 index 0000000000000..3643f9df75135 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicasClientImpl.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.ReplicasClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.ReplicaInner; +import com.azure.resourcemanager.mongoclustertest.models.ReplicaListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ReplicasClient. + */ +public final class ReplicasClientImpl implements ReplicasClient { + /** + * The proxy service used to perform REST calls. + */ + private final ReplicasService service; + + /** + * The service client containing this operation class. + */ + private final MongoClusterManagementClientImpl client; + + /** + * Initializes an instance of ReplicasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReplicasClientImpl(MongoClusterManagementClientImpl client) { + this.service = RestProxy.create(ReplicasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MongoClusterManagementClientReplicas to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MongoClusterManageme") + public interface ReplicasService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/replicas") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParent(@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> listByParentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List all the replicas for the 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 Replica list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentSinglePageAsync(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.listByParent(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 replicas for the 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 Replica list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentSinglePageAsync(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 + .listByParent(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 replicas for the 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 Replica list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByParentAsync(String resourceGroupName, String mongoClusterName) { + return new PagedFlux<>(() -> listByParentSinglePageAsync(resourceGroupName, mongoClusterName), + nextLink -> listByParentNextSinglePageAsync(nextLink)); + } + + /** + * List all the replicas for the 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 Replica list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByParentAsync(String resourceGroupName, String mongoClusterName, + Context context) { + return new PagedFlux<>(() -> listByParentSinglePageAsync(resourceGroupName, mongoClusterName, context), + nextLink -> listByParentNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the replicas for the 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 Replica list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceGroupName, String mongoClusterName) { + return new PagedIterable<>(listByParentAsync(resourceGroupName, mongoClusterName)); + } + + /** + * List all the replicas for the 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 Replica list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceGroupName, String mongoClusterName, + Context context) { + return new PagedIterable<>(listByParentAsync(resourceGroupName, mongoClusterName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Replica list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentNextSinglePageAsync(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.listByParentNext(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. + * @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 Replica list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentNextSinglePageAsync(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.listByParentNext(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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicasImpl.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicasImpl.java new file mode 100644 index 0000000000000..23175740060cc --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ReplicasImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.ReplicasClient; +import com.azure.resourcemanager.mongoclustertest.fluent.models.ReplicaInner; +import com.azure.resourcemanager.mongoclustertest.models.Replica; +import com.azure.resourcemanager.mongoclustertest.models.Replicas; + +public final class ReplicasImpl implements Replicas { + private static final ClientLogger LOGGER = new ClientLogger(ReplicasImpl.class); + + private final ReplicasClient innerClient; + + private final com.azure.resourcemanager.mongoclustertest.MongoClusterManager serviceManager; + + public ReplicasImpl(ReplicasClient innerClient, + com.azure.resourcemanager.mongoclustertest.MongoClusterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByParent(String resourceGroupName, String mongoClusterName) { + PagedIterable inner = this.serviceClient().listByParent(resourceGroupName, mongoClusterName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ReplicaImpl(inner1, this.manager())); + } + + public PagedIterable listByParent(String resourceGroupName, String mongoClusterName, Context context) { + PagedIterable inner + = this.serviceClient().listByParent(resourceGroupName, mongoClusterName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ReplicaImpl(inner1, this.manager())); + } + + private ReplicasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ResourceManagerUtils.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..05de0770d2408 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/package-info.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/implementation/package-info.java new file mode 100644 index 0000000000000..4bd842ef387ef --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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. + * 111 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.mongoclustertest.implementation; diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ActionType.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ActionType.java new file mode 100644 index 0000000000000..26d22683e018b --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityReason.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..0e63b54416372 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityReason.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.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityRequest.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..b247e89963261 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The check availability request body. + */ +@Fluent +public final class CheckNameAvailabilityRequest implements JsonSerializable { + /* + * The name of the resource for which availability needs to be checked. + */ + private String name; + + /* + * The resource 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckNameAvailabilityRequest. + */ + public static CheckNameAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityRequest deserializedCheckNameAvailabilityRequest = new CheckNameAvailabilityRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityRequest; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityResponse.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..d61fb53bcf9db --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CheckNameAvailabilityResponse.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.mongoclustertest.models; + +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.models.CheckNameAvailabilityResponseInner + * object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ConnectionString.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ConnectionString.java new file mode 100644 index 0000000000000..2cb14cbb13111 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ConnectionString.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Connection string for the mongo cluster. + */ +@Immutable +public final class ConnectionString implements JsonSerializable { + /* + * Value of the connection string + */ + private String connectionString; + + /* + * Description of the connection string + */ + 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectionString from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectionString if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectionString. + */ + public static ConnectionString fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionString deserializedConnectionString = new ConnectionString(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectionString".equals(fieldName)) { + deserializedConnectionString.connectionString = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedConnectionString.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectionString; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CreateMode.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CreateMode.java new file mode 100644 index 0000000000000..f0d9192be929a --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/CreateMode.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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"); + + /** + * Static value GeoReplica for CreateMode. + */ + public static final CreateMode GEO_REPLICA = fromString("GeoReplica"); + + /** + * Static value Replica for CreateMode. + */ + public static final CreateMode REPLICA = fromString("Replica"); + + /** + * 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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRule.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRule.java new file mode 100644 index 0000000000000..ca1bf66db5eaa --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRule.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.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 extends UpdateStages.WithProperties { + /** + * 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 { + /** + * The stage of the FirewallRule update 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. + */ + Update withProperties(FirewallRuleProperties properties); + } + } + + /** + * 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRuleListResult.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRuleListResult.java new file mode 100644 index 0000000000000..b1f0f6d3f4433 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRuleListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.fluent.models.FirewallRuleInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a FirewallRule list operation. + */ +@Fluent +public final class FirewallRuleListResult implements JsonSerializable { + /* + * The FirewallRule items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + 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); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirewallRuleListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirewallRuleListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FirewallRuleListResult. + */ + public static FirewallRuleListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirewallRuleListResult deserializedFirewallRuleListResult = new FirewallRuleListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> FirewallRuleInner.fromJson(reader1)); + deserializedFirewallRuleListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFirewallRuleListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFirewallRuleListResult; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRuleProperties.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRuleProperties.java new file mode 100644 index 0000000000000..1782d37ced089 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRuleProperties.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of a mongo cluster firewall rule. + */ +@Fluent +public final class FirewallRuleProperties implements JsonSerializable { + /* + * The provisioning state of the firewall rule. + */ + private ProvisioningState provisioningState; + + /* + * The start IP address of the mongo cluster firewall rule. Must be IPv4 format. + */ + private String startIpAddress; + + /* + * The end IP address of the mongo cluster firewall rule. Must be IPv4 format. + */ + 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); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startIpAddress", this.startIpAddress); + jsonWriter.writeStringField("endIpAddress", this.endIpAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirewallRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirewallRuleProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FirewallRuleProperties. + */ + public static FirewallRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirewallRuleProperties deserializedFirewallRuleProperties = new FirewallRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startIpAddress".equals(fieldName)) { + deserializedFirewallRuleProperties.startIpAddress = reader.getString(); + } else if ("endIpAddress".equals(fieldName)) { + deserializedFirewallRuleProperties.endIpAddress = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedFirewallRuleProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedFirewallRuleProperties; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRules.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/FirewallRules.java new file mode 100644 index 0000000000000..cbc70280e8ed5 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ListConnectionStringsResult.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ListConnectionStringsResult.java new file mode 100644 index 0000000000000..16d0357d3261d --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.models; + +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.models.ListConnectionStringsResultInner object. + * + * @return the inner object. + */ + ListConnectionStringsResultInner innerModel(); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoCluster.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoCluster.java new file mode 100644 index 0000000000000..0a428e0361f6d --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoCluster.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.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.mongoclustertest.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 resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @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(); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void promote(PromoteReplicaRequest body); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void promote(PromoteReplicaRequest body, Context context); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterListResult.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterListResult.java new file mode 100644 index 0000000000000..70ac75910bf80 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.fluent.models.MongoClusterInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a MongoCluster list operation. + */ +@Fluent +public final class MongoClusterListResult implements JsonSerializable { + /* + * The MongoCluster items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + 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); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoClusterListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoClusterListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoClusterListResult. + */ + public static MongoClusterListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoClusterListResult deserializedMongoClusterListResult = new MongoClusterListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> MongoClusterInner.fromJson(reader1)); + deserializedMongoClusterListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMongoClusterListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoClusterListResult; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterProperties.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterProperties.java new file mode 100644 index 0000000000000..b356b7823e219 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterProperties.java @@ -0,0 +1,460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties of a mongo cluster. + */ +@Fluent +public final class MongoClusterProperties implements JsonSerializable { + /* + * The mode to create a mongo cluster. + */ + private CreateMode createMode; + + /* + * The parameters to create a point-in-time restore mongo cluster. + */ + private MongoClusterRestoreParameters restoreParameters; + + /* + * The parameters to create a replica mongo cluster. + */ + private MongoClusterReplicaParameters replicaParameters; + + /* + * The administrator's login for the mongo cluster. + */ + private String administratorLogin; + + /* + * The password of the administrator login. + */ + private String administratorLoginPassword; + + /* + * The Mongo DB server version. Defaults to the latest available version if not specified. + */ + private String serverVersion; + + /* + * The default mongo connection string for the cluster. + */ + private String connectionString; + + /* + * Earliest restore timestamp in UTC ISO8601 format. + */ + private String earliestRestoreTime; + + /* + * The provisioning state of the mongo cluster. + */ + private ProvisioningState provisioningState; + + /* + * The status of the mongo cluster. + */ + private MongoClusterStatus clusterStatus; + + /* + * Whether or not public endpoint access is allowed for this mongo cluster. + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * The list of node group specs in the cluster. + */ + private List nodeGroupSpecs; + + /* + * List of private endpoint connections. + */ + private List privateEndpointConnections; + + /* + * List of private endpoint connections. + */ + private List previewFeatures; + + /* + * The replication properties for the mongo cluster + */ + private ReplicationProperties replica; + + /* + * The infrastructure version the cluster is provisioned on. + */ + private String infrastructureVersion; + + /** + * 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 replicaParameters property: The parameters to create a replica mongo cluster. + * + * @return the replicaParameters value. + */ + public MongoClusterReplicaParameters replicaParameters() { + return this.replicaParameters; + } + + /** + * Set the replicaParameters property: The parameters to create a replica mongo cluster. + * + * @param replicaParameters the replicaParameters value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withReplicaParameters(MongoClusterReplicaParameters replicaParameters) { + this.replicaParameters = replicaParameters; + 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; + } + + /** + * Get the previewFeatures property: List of private endpoint connections. + * + * @return the previewFeatures value. + */ + public List previewFeatures() { + return this.previewFeatures; + } + + /** + * Set the previewFeatures property: List of private endpoint connections. + * + * @param previewFeatures the previewFeatures value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withPreviewFeatures(List previewFeatures) { + this.previewFeatures = previewFeatures; + return this; + } + + /** + * Get the replica property: The replication properties for the mongo cluster. + * + * @return the replica value. + */ + public ReplicationProperties replica() { + return this.replica; + } + + /** + * Get the infrastructureVersion property: The infrastructure version the cluster is provisioned on. + * + * @return the infrastructureVersion value. + */ + public String infrastructureVersion() { + return this.infrastructureVersion; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restoreParameters() != null) { + restoreParameters().validate(); + } + if (replicaParameters() != null) { + replicaParameters().validate(); + } + if (nodeGroupSpecs() != null) { + nodeGroupSpecs().forEach(e -> e.validate()); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (replica() != null) { + replica().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeJsonField("restoreParameters", this.restoreParameters); + jsonWriter.writeJsonField("replicaParameters", this.replicaParameters); + jsonWriter.writeStringField("administratorLogin", this.administratorLogin); + jsonWriter.writeStringField("administratorLoginPassword", this.administratorLoginPassword); + jsonWriter.writeStringField("serverVersion", this.serverVersion); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeArrayField("nodeGroupSpecs", this.nodeGroupSpecs, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("previewFeatures", this.previewFeatures, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoClusterProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoClusterProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoClusterProperties. + */ + public static MongoClusterProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoClusterProperties deserializedMongoClusterProperties = new MongoClusterProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("createMode".equals(fieldName)) { + deserializedMongoClusterProperties.createMode = CreateMode.fromString(reader.getString()); + } else if ("restoreParameters".equals(fieldName)) { + deserializedMongoClusterProperties.restoreParameters + = MongoClusterRestoreParameters.fromJson(reader); + } else if ("replicaParameters".equals(fieldName)) { + deserializedMongoClusterProperties.replicaParameters + = MongoClusterReplicaParameters.fromJson(reader); + } else if ("administratorLogin".equals(fieldName)) { + deserializedMongoClusterProperties.administratorLogin = reader.getString(); + } else if ("administratorLoginPassword".equals(fieldName)) { + deserializedMongoClusterProperties.administratorLoginPassword = reader.getString(); + } else if ("serverVersion".equals(fieldName)) { + deserializedMongoClusterProperties.serverVersion = reader.getString(); + } else if ("connectionString".equals(fieldName)) { + deserializedMongoClusterProperties.connectionString = reader.getString(); + } else if ("earliestRestoreTime".equals(fieldName)) { + deserializedMongoClusterProperties.earliestRestoreTime = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedMongoClusterProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("clusterStatus".equals(fieldName)) { + deserializedMongoClusterProperties.clusterStatus + = MongoClusterStatus.fromString(reader.getString()); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedMongoClusterProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("nodeGroupSpecs".equals(fieldName)) { + List nodeGroupSpecs = reader.readArray(reader1 -> NodeGroupSpec.fromJson(reader1)); + deserializedMongoClusterProperties.nodeGroupSpecs = nodeGroupSpecs; + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> PrivateEndpointConnection.fromJson(reader1)); + deserializedMongoClusterProperties.privateEndpointConnections = privateEndpointConnections; + } else if ("previewFeatures".equals(fieldName)) { + List previewFeatures + = reader.readArray(reader1 -> PreviewFeature.fromString(reader1.getString())); + deserializedMongoClusterProperties.previewFeatures = previewFeatures; + } else if ("replica".equals(fieldName)) { + deserializedMongoClusterProperties.replica = ReplicationProperties.fromJson(reader); + } else if ("infrastructureVersion".equals(fieldName)) { + deserializedMongoClusterProperties.infrastructureVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoClusterProperties; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterReplicaParameters.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterReplicaParameters.java new file mode 100644 index 0000000000000..471e61ea600fa --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterReplicaParameters.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Parameters used for replica operations. + */ +@Fluent +public final class MongoClusterReplicaParameters implements JsonSerializable { + /* + * The id of the replication source cluster. + */ + private String sourceResourceId; + + /* + * The location of the source cluster + */ + private String sourceLocation; + + /** + * Creates an instance of MongoClusterReplicaParameters class. + */ + public MongoClusterReplicaParameters() { + } + + /** + * Get the sourceResourceId property: The id of the replication source cluster. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Set the sourceResourceId property: The id of the replication source cluster. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the MongoClusterReplicaParameters object itself. + */ + public MongoClusterReplicaParameters withSourceResourceId(String sourceResourceId) { + this.sourceResourceId = sourceResourceId; + return this; + } + + /** + * Get the sourceLocation property: The location of the source cluster. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.sourceLocation; + } + + /** + * Set the sourceLocation property: The location of the source cluster. + * + * @param sourceLocation the sourceLocation value to set. + * @return the MongoClusterReplicaParameters object itself. + */ + public MongoClusterReplicaParameters withSourceLocation(String sourceLocation) { + this.sourceLocation = sourceLocation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceResourceId in model MongoClusterReplicaParameters")); + } + if (sourceLocation() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceLocation in model MongoClusterReplicaParameters")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MongoClusterReplicaParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("sourceLocation", this.sourceLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoClusterReplicaParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoClusterReplicaParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MongoClusterReplicaParameters. + */ + public static MongoClusterReplicaParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoClusterReplicaParameters deserializedMongoClusterReplicaParameters + = new MongoClusterReplicaParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceResourceId".equals(fieldName)) { + deserializedMongoClusterReplicaParameters.sourceResourceId = reader.getString(); + } else if ("sourceLocation".equals(fieldName)) { + deserializedMongoClusterReplicaParameters.sourceLocation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoClusterReplicaParameters; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterRestoreParameters.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterRestoreParameters.java new file mode 100644 index 0000000000000..602855fca3887 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterRestoreParameters.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.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Parameters used for restore operations. + */ +@Fluent +public final class MongoClusterRestoreParameters implements JsonSerializable { + /* + * UTC point in time to restore a mongo cluster + */ + private OffsetDateTime pointInTimeUtc; + + /* + * Resource ID to locate the source cluster to restore + */ + 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pointInTimeUTC", + this.pointInTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.pointInTimeUtc)); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoClusterRestoreParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoClusterRestoreParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoClusterRestoreParameters. + */ + public static MongoClusterRestoreParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoClusterRestoreParameters deserializedMongoClusterRestoreParameters + = new MongoClusterRestoreParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pointInTimeUTC".equals(fieldName)) { + deserializedMongoClusterRestoreParameters.pointInTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedMongoClusterRestoreParameters.sourceResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoClusterRestoreParameters; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterStatus.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterStatus.java new file mode 100644 index 0000000000000..ef5c8fe9fb736 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterStatus.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterUpdate.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterUpdate.java new file mode 100644 index 0000000000000..812e09acb8ece --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterUpdate.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.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the MongoCluster. + */ +@Fluent +public final class MongoClusterUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + 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 resource-specific properties for this resource. + * + * @return the properties value. + */ + public MongoClusterUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoClusterUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoClusterUpdate if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoClusterUpdate. + */ + public static MongoClusterUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoClusterUpdate deserializedMongoClusterUpdate = new MongoClusterUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMongoClusterUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedMongoClusterUpdate.properties = MongoClusterUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMongoClusterUpdate; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterUpdateProperties.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterUpdateProperties.java new file mode 100644 index 0000000000000..3440defd80916 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusterUpdateProperties.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The updatable properties of the MongoCluster. + */ +@Fluent +public final class MongoClusterUpdateProperties implements JsonSerializable { + /* + * The administrator's login for the mongo cluster. + */ + private String administratorLogin; + + /* + * The password of the administrator login. + */ + private String administratorLoginPassword; + + /* + * The Mongo DB server version. Defaults to the latest available version if not specified. + */ + private String serverVersion; + + /* + * Whether or not public endpoint access is allowed for this mongo cluster. + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * The list of node group specs in the cluster. + */ + private List nodeGroupSpecs; + + /* + * List of private endpoint connections. + */ + private List previewFeatures; + + /** + * 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; + } + + /** + * Get the previewFeatures property: List of private endpoint connections. + * + * @return the previewFeatures value. + */ + public List previewFeatures() { + return this.previewFeatures; + } + + /** + * Set the previewFeatures property: List of private endpoint connections. + * + * @param previewFeatures the previewFeatures value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withPreviewFeatures(List previewFeatures) { + this.previewFeatures = previewFeatures; + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("administratorLogin", this.administratorLogin); + jsonWriter.writeStringField("administratorLoginPassword", this.administratorLoginPassword); + jsonWriter.writeStringField("serverVersion", this.serverVersion); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeArrayField("nodeGroupSpecs", this.nodeGroupSpecs, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("previewFeatures", this.previewFeatures, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MongoClusterUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MongoClusterUpdateProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MongoClusterUpdateProperties. + */ + public static MongoClusterUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MongoClusterUpdateProperties deserializedMongoClusterUpdateProperties = new MongoClusterUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("administratorLogin".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.administratorLogin = reader.getString(); + } else if ("administratorLoginPassword".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.administratorLoginPassword = reader.getString(); + } else if ("serverVersion".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.serverVersion = reader.getString(); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("nodeGroupSpecs".equals(fieldName)) { + List nodeGroupSpecs = reader.readArray(reader1 -> NodeGroupSpec.fromJson(reader1)); + deserializedMongoClusterUpdateProperties.nodeGroupSpecs = nodeGroupSpecs; + } else if ("previewFeatures".equals(fieldName)) { + List previewFeatures + = reader.readArray(reader1 -> PreviewFeature.fromString(reader1.getString())); + deserializedMongoClusterUpdateProperties.previewFeatures = previewFeatures; + } else { + reader.skipChildren(); + } + } + + return deserializedMongoClusterUpdateProperties; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusters.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusters.java new file mode 100644 index 0000000000000..667542ccc706a --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/MongoClusters.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.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); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, Context context); + + /** + * 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/NodeGroupSpec.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/NodeGroupSpec.java new file mode 100644 index 0000000000000..7a7644ec81e19 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/NodeGroupSpec.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specification for a node group. + */ +@Fluent +public final class NodeGroupSpec implements JsonSerializable { + /* + * 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'. + */ + private String sku; + + /* + * The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. + */ + private Long diskSizeGB; + + /* + * Whether high availability is enabled on the node group. + */ + private Boolean enableHa; + + /* + * The node type deployed in the node group. + */ + private NodeKind kind; + + /* + * The number of nodes in the node group. + */ + 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sku", this.sku); + jsonWriter.writeNumberField("diskSizeGB", this.diskSizeGB); + jsonWriter.writeBooleanField("enableHa", this.enableHa); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeNumberField("nodeCount", this.nodeCount); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NodeGroupSpec from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NodeGroupSpec if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the NodeGroupSpec. + */ + public static NodeGroupSpec fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NodeGroupSpec deserializedNodeGroupSpec = new NodeGroupSpec(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sku".equals(fieldName)) { + deserializedNodeGroupSpec.sku = reader.getString(); + } else if ("diskSizeGB".equals(fieldName)) { + deserializedNodeGroupSpec.diskSizeGB = reader.getNullable(JsonReader::getLong); + } else if ("enableHa".equals(fieldName)) { + deserializedNodeGroupSpec.enableHa = reader.getNullable(JsonReader::getBoolean); + } else if ("kind".equals(fieldName)) { + deserializedNodeGroupSpec.kind = NodeKind.fromString(reader.getString()); + } else if ("nodeCount".equals(fieldName)) { + deserializedNodeGroupSpec.nodeCount = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedNodeGroupSpec; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/NodeKind.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/NodeKind.java new file mode 100644 index 0000000000000..b80dd78af709d --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/NodeKind.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Operation.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Operation.java new file mode 100644 index 0000000000000..950a3f735a8b9 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.models; + +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/OperationDisplay.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/OperationDisplay.java new file mode 100644 index 0000000000000..f444188103cd2 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/OperationListResult.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/OperationListResult.java new file mode 100644 index 0000000000000..4b16453f648ba --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.fluent.models.OperationInner; +import java.io.IOException; +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 implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Operations.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Operations.java new file mode 100644 index 0000000000000..453f804b30365 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Origin.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Origin.java new file mode 100644 index 0000000000000..45b538ed06264 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PreviewFeature.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PreviewFeature.java new file mode 100644 index 0000000000000..d4b879d842c9a --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PreviewFeature.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Preview features that can be enabled on a mongo cluster. + */ +public final class PreviewFeature extends ExpandableStringEnum { + /** + * Static value GeoReplicas for PreviewFeature. + */ + public static final PreviewFeature GEO_REPLICAS = fromString("GeoReplicas"); + + /** + * Creates a new instance of PreviewFeature value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PreviewFeature() { + } + + /** + * Creates or finds a PreviewFeature from its string representation. + * + * @param name a name to look for. + * @return the corresponding PreviewFeature. + */ + public static PreviewFeature fromString(String name) { + return fromString(name, PreviewFeature.class); + } + + /** + * Gets known PreviewFeature values. + * + * @return known PreviewFeature values. + */ + public static Collection values() { + return values(PreviewFeature.class); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpoint.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpoint.java new file mode 100644 index 0000000000000..3baeeddc14506 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpoint.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.mongoclustertest.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The private endpoint resource. + */ +@Immutable +public final class PrivateEndpoint implements JsonSerializable { + /* + * The ARM identifier for private endpoint. + */ + 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpoint. + */ + public static PrivateEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpoint deserializedPrivateEndpoint = new PrivateEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpoint.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpoint; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnection.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..212e5d0e4c25f --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnection.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The private endpoint connection resource. + */ +@Fluent +public final class PrivateEndpointConnection extends ProxyResource { + /* + * Resource properties. + */ + private PrivateEndpointConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /* + * The name of the resource. + */ + private String name; + + /* + * The type of the resource. + */ + private String type; + + /** + * Creates an instance of PrivateEndpointConnection class. + */ + public PrivateEndpointConnection() { + } + + /** + * Get the properties property: Resource properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Resource properties. + * + * @param properties the properties value to set. + * @return the PrivateEndpointConnection object itself. + */ + public PrivateEndpointConnection 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; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnection if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnection. + */ + public static PrivateEndpointConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnection deserializedPrivateEndpointConnection = new PrivateEndpointConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnection.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnection.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnection.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnection.properties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateEndpointConnection.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnection; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionProperties.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..55ba8f9e17cd2 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of the private endpoint connection. + */ +@Fluent +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * The group ids for the private endpoint resource. + */ + private List groupIds; + + /* + * The private endpoint resource. + */ + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + 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); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionProperties. + */ + public static PrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionProperties deserializedPrivateEndpointConnectionProperties + = new PrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionState.fromJson(reader); + } else if ("groupIds".equals(fieldName)) { + List groupIds = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateEndpointConnectionProperties.groupIds = groupIds; + } else if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint = PrivateEndpoint.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState + = PrivateEndpointConnectionProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionProvisioningState.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 0000000000000..fe3c956a389f9 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionResource.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionResource.java new file mode 100644 index 0000000000000..e69f099cb7a93 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionResourceListResult.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionResourceListResult.java new file mode 100644 index 0000000000000..4fbf23d888265 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnectionResourceListResult.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.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.fluent.models.PrivateEndpointConnectionResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PrivateEndpointConnectionResource list operation. + */ +@Fluent +public final class PrivateEndpointConnectionResourceListResult + implements JsonSerializable { + /* + * The PrivateEndpointConnectionResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + 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); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionResourceListResult if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionResourceListResult. + */ + public static PrivateEndpointConnectionResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionResourceListResult deserializedPrivateEndpointConnectionResourceListResult + = new PrivateEndpointConnectionResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateEndpointConnectionResourceInner.fromJson(reader1)); + deserializedPrivateEndpointConnectionResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateEndpointConnectionResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionResourceListResult; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnections.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..6b5c92c64d1f0 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointServiceConnectionStatus.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 0000000000000..23394d4ec25a0 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateEndpointServiceConnectionStatus.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResource.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..e91eb883482a2 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongoclustertest.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.mongoclustertest.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResourceListResult.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..093c0a1a8af22 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResourceListResult.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.fluent.models.PrivateLinkResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PrivateLinkResource list operation. + */ +@Fluent +public final class PrivateLinkResourceListResult implements JsonSerializable { + /* + * The PrivateLinkResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + 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); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateLinkResourceListResult. + */ + public static PrivateLinkResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceListResult deserializedPrivateLinkResourceListResult + = new PrivateLinkResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateLinkResourceInner.fromJson(reader1)); + deserializedPrivateLinkResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateLinkResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceListResult; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResourceProperties.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..ca7ab806101d5 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkResourceProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a private link resource. + */ +@Fluent +public final class PrivateLinkResourceProperties implements JsonSerializable { + /* + * The private link resource group id. + */ + private String groupId; + + /* + * The private link resource required member names. + */ + private List requiredMembers; + + /* + * The private link resource private link DNS zone name. + */ + 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("requiredZoneNames", this.requiredZoneNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkResourceProperties. + */ + public static PrivateLinkResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceProperties deserializedPrivateLinkResourceProperties + = new PrivateLinkResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groupId".equals(fieldName)) { + deserializedPrivateLinkResourceProperties.groupId = reader.getString(); + } else if ("requiredMembers".equals(fieldName)) { + List requiredMembers = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredMembers = requiredMembers; + } else if ("requiredZoneNames".equals(fieldName)) { + List requiredZoneNames = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredZoneNames = requiredZoneNames; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceProperties; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkServiceConnectionState.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..ef072d1803c96 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A collection of information about the state of the connection between service consumer and provider. + */ +@Fluent +public final class PrivateLinkServiceConnectionState implements JsonSerializable { + /* + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("actionsRequired", this.actionsRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkServiceConnectionState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkServiceConnectionState if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkServiceConnectionState. + */ + public static PrivateLinkServiceConnectionState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkServiceConnectionState deserializedPrivateLinkServiceConnectionState + = new PrivateLinkServiceConnectionState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.status + = PrivateEndpointServiceConnectionStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.actionsRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkServiceConnectionState; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinks.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PrivateLinks.java new file mode 100644 index 0000000000000..9675aa94699d9 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteMode.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteMode.java new file mode 100644 index 0000000000000..ab561cca953c8 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteMode.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The mode to apply to a promote operation. + */ +public final class PromoteMode extends ExpandableStringEnum { + /** + * Static value Switchover for PromoteMode. + */ + public static final PromoteMode SWITCHOVER = fromString("Switchover"); + + /** + * Creates a new instance of PromoteMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PromoteMode() { + } + + /** + * Creates or finds a PromoteMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding PromoteMode. + */ + public static PromoteMode fromString(String name) { + return fromString(name, PromoteMode.class); + } + + /** + * Gets known PromoteMode values. + * + * @return known PromoteMode values. + */ + public static Collection values() { + return values(PromoteMode.class); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteOption.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteOption.java new file mode 100644 index 0000000000000..79503db72cbe0 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteOption.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The option to apply to a promote operation. + */ +public final class PromoteOption extends ExpandableStringEnum { + /** + * Static value Forced for PromoteOption. + */ + public static final PromoteOption FORCED = fromString("Forced"); + + /** + * Creates a new instance of PromoteOption value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PromoteOption() { + } + + /** + * Creates or finds a PromoteOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding PromoteOption. + */ + public static PromoteOption fromString(String name) { + return fromString(name, PromoteOption.class); + } + + /** + * Gets known PromoteOption values. + * + * @return known PromoteOption values. + */ + public static Collection values() { + return values(PromoteOption.class); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteReplicaRequest.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteReplicaRequest.java new file mode 100644 index 0000000000000..0032b2956fca1 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PromoteReplicaRequest.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Promote replica request properties. + */ +@Fluent +public final class PromoteReplicaRequest implements JsonSerializable { + /* + * The promote option to apply to the operation. + */ + private PromoteOption promoteOption; + + /* + * The mode to apply to the promote operation. Value is optional and default value is 'Switchover'. + */ + private PromoteMode mode; + + /** + * Creates an instance of PromoteReplicaRequest class. + */ + public PromoteReplicaRequest() { + } + + /** + * Get the promoteOption property: The promote option to apply to the operation. + * + * @return the promoteOption value. + */ + public PromoteOption promoteOption() { + return this.promoteOption; + } + + /** + * Set the promoteOption property: The promote option to apply to the operation. + * + * @param promoteOption the promoteOption value to set. + * @return the PromoteReplicaRequest object itself. + */ + public PromoteReplicaRequest withPromoteOption(PromoteOption promoteOption) { + this.promoteOption = promoteOption; + return this; + } + + /** + * Get the mode property: The mode to apply to the promote operation. Value is optional and default value is + * 'Switchover'. + * + * @return the mode value. + */ + public PromoteMode mode() { + return this.mode; + } + + /** + * Set the mode property: The mode to apply to the promote operation. Value is optional and default value is + * 'Switchover'. + * + * @param mode the mode value to set. + * @return the PromoteReplicaRequest object itself. + */ + public PromoteReplicaRequest withMode(PromoteMode mode) { + this.mode = mode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (promoteOption() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property promoteOption in model PromoteReplicaRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PromoteReplicaRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("promoteOption", this.promoteOption == null ? null : this.promoteOption.toString()); + jsonWriter.writeStringField("mode", this.mode == null ? null : this.mode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PromoteReplicaRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PromoteReplicaRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PromoteReplicaRequest. + */ + public static PromoteReplicaRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PromoteReplicaRequest deserializedPromoteReplicaRequest = new PromoteReplicaRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("promoteOption".equals(fieldName)) { + deserializedPromoteReplicaRequest.promoteOption = PromoteOption.fromString(reader.getString()); + } else if ("mode".equals(fieldName)) { + deserializedPromoteReplicaRequest.mode = PromoteMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPromoteReplicaRequest; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ProvisioningState.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ProvisioningState.java new file mode 100644 index 0000000000000..a547365dcc24e --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PublicNetworkAccess.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..df6f8799104aa --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/PublicNetworkAccess.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Replica.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Replica.java new file mode 100644 index 0000000000000..2880937bf6333 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Replica.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.mongoclustertest.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongoclustertest.fluent.models.ReplicaInner; + +/** + * An immutable client-side representation of Replica. + */ +public interface Replica { + /** + * 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. + */ + MongoClusterProperties 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.mongoclustertest.fluent.models.ReplicaInner object. + * + * @return the inner object. + */ + ReplicaInner innerModel(); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicaListResult.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicaListResult.java new file mode 100644 index 0000000000000..be9b6f45c61a3 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicaListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mongoclustertest.fluent.models.ReplicaInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Replica list operation. + */ +@Fluent +public final class ReplicaListResult implements JsonSerializable { + /* + * The Replica items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ReplicaListResult class. + */ + public ReplicaListResult() { + } + + /** + * Get the value property: The Replica items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Replica items on this page. + * + * @param value the value value to set. + * @return the ReplicaListResult object itself. + */ + public ReplicaListResult 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 ReplicaListResult object itself. + */ + public ReplicaListResult 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 ReplicaListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ReplicaListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ReplicaListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ReplicaListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ReplicaListResult. + */ + public static ReplicaListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ReplicaListResult deserializedReplicaListResult = new ReplicaListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ReplicaInner.fromJson(reader1)); + deserializedReplicaListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedReplicaListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedReplicaListResult; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Replicas.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Replicas.java new file mode 100644 index 0000000000000..f385d3dfc2fdb --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/Replicas.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Replicas. + */ +public interface Replicas { + /** + * List all the replicas for the 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 Replica list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceGroupName, String mongoClusterName); + + /** + * List all the replicas for the 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 Replica list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceGroupName, String mongoClusterName, Context context); +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationProperties.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationProperties.java new file mode 100644 index 0000000000000..c23089ce58338 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Replica properties of the mongo cluster. + */ +@Immutable +public final class ReplicationProperties implements JsonSerializable { + /* + * The resource id the source cluster for the replica cluster. + */ + private String sourceResourceId; + + /* + * The replication role of the cluster + */ + private ReplicationRole role; + + /* + * The replication link state of the replica cluster. + */ + private ReplicationState replicationState; + + /** + * Creates an instance of ReplicationProperties class. + */ + public ReplicationProperties() { + } + + /** + * Get the sourceResourceId property: The resource id the source cluster for the replica cluster. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Get the role property: The replication role of the cluster. + * + * @return the role value. + */ + public ReplicationRole role() { + return this.role; + } + + /** + * Get the replicationState property: The replication link state of the replica cluster. + * + * @return the replicationState value. + */ + public ReplicationState replicationState() { + return this.replicationState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ReplicationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ReplicationProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ReplicationProperties. + */ + public static ReplicationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ReplicationProperties deserializedReplicationProperties = new ReplicationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceResourceId".equals(fieldName)) { + deserializedReplicationProperties.sourceResourceId = reader.getString(); + } else if ("role".equals(fieldName)) { + deserializedReplicationProperties.role = ReplicationRole.fromString(reader.getString()); + } else if ("replicationState".equals(fieldName)) { + deserializedReplicationProperties.replicationState + = ReplicationState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedReplicationProperties; + }); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationRole.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationRole.java new file mode 100644 index 0000000000000..52ba0025f46c1 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationRole.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Replication role of the mongo cluster. + */ +public final class ReplicationRole extends ExpandableStringEnum { + /** + * Static value Primary for ReplicationRole. + */ + public static final ReplicationRole PRIMARY = fromString("Primary"); + + /** + * Static value AsyncReplica for ReplicationRole. + */ + public static final ReplicationRole ASYNC_REPLICA = fromString("AsyncReplica"); + + /** + * Static value GeoAsyncReplica for ReplicationRole. + */ + public static final ReplicationRole GEO_ASYNC_REPLICA = fromString("GeoAsyncReplica"); + + /** + * Creates a new instance of ReplicationRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ReplicationRole() { + } + + /** + * Creates or finds a ReplicationRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationRole. + */ + public static ReplicationRole fromString(String name) { + return fromString(name, ReplicationRole.class); + } + + /** + * Gets known ReplicationRole values. + * + * @return known ReplicationRole values. + */ + public static Collection values() { + return values(ReplicationRole.class); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationState.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationState.java new file mode 100644 index 0000000000000..6beacba49f59d --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/ReplicationState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of the replication link between the replica and source cluster. + */ +public final class ReplicationState extends ExpandableStringEnum { + /** + * Static value Active for ReplicationState. + */ + public static final ReplicationState ACTIVE = fromString("Active"); + + /** + * Static value Catchup for ReplicationState. + */ + public static final ReplicationState CATCHUP = fromString("Catchup"); + + /** + * Static value Provisioning for ReplicationState. + */ + public static final ReplicationState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for ReplicationState. + */ + public static final ReplicationState UPDATING = fromString("Updating"); + + /** + * Static value Broken for ReplicationState. + */ + public static final ReplicationState BROKEN = fromString("Broken"); + + /** + * Static value Reconfiguring for ReplicationState. + */ + public static final ReplicationState RECONFIGURING = fromString("Reconfiguring"); + + /** + * Creates a new instance of ReplicationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ReplicationState() { + } + + /** + * Creates or finds a ReplicationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationState. + */ + public static ReplicationState fromString(String name) { + return fromString(name, ReplicationState.class); + } + + /** + * Gets known ReplicationState values. + * + * @return known ReplicationState values. + */ + public static Collection values() { + return values(ReplicationState.class); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/package-info.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/models/package-info.java new file mode 100644 index 0000000000000..dc0165661332a --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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. + * 111 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.mongoclustertest.models; diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/package-info.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/package-info.java new file mode 100644 index 0000000000000..ebd03edf1df15 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/com/azure/resourcemanager/mongoclustertest/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. + * 111 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.mongoclustertest; diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/module-info.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/java/module-info.java new file mode 100644 index 0000000000000..61b13dd486769 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/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.mongoclustertest { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.mongoclustertest; + exports com.azure.resourcemanager.mongoclustertest.fluent; + exports com.azure.resourcemanager.mongoclustertest.fluent.models; + exports com.azure.resourcemanager.mongoclustertest.models; + opens com.azure.resourcemanager.mongoclustertest.fluent.models to com.azure.core; + opens com.azure.resourcemanager.mongoclustertest.models to com.azure.core; +} \ No newline at end of file diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongoclustertest/proxy-config.json b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongoclustertest/proxy-config.json new file mode 100644 index 0000000000000..b0ee5cc14d0e8 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongoclustertest/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.mongoclustertest.implementation.FirewallRulesClientImpl$FirewallRulesService"],["com.azure.resourcemanager.mongoclustertest.implementation.MongoClustersClientImpl$MongoClustersService"],["com.azure.resourcemanager.mongoclustertest.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.mongoclustertest.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService"],["com.azure.resourcemanager.mongoclustertest.implementation.PrivateLinksClientImpl$PrivateLinksService"],["com.azure.resourcemanager.mongoclustertest.implementation.ReplicasClientImpl$ReplicasService"]] \ No newline at end of file diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongoclustertest/reflect-config.json b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongoclustertest/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongoclustertest/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..f658fd8abf646 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.generated; + +import com.azure.resourcemanager.mongoclustertest.models.FirewallRuleProperties; + +/** + * Samples for FirewallRules CreateOrUpdate. + */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesDeleteSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesDeleteSamples.java new file mode 100644 index 0000000000000..cda02ebbe0157 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesDeleteSamples.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.mongoclustertest.generated; + +/** + * Samples for FirewallRules Delete. + */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.firewallRules().delete("TestGroup", "myMongoCluster", "rule1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesGetSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesGetSamples.java new file mode 100644 index 0000000000000..87b1ad774bf3b --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.generated; + +/** + * Samples for FirewallRules Get. + */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.firewallRules() + .getWithResponse("TestGroup", "myMongoCluster", "rule1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesListByMongoClusterSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesListByMongoClusterSamples.java new file mode 100644 index 0000000000000..37c4379c65ecf --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/FirewallRulesListByMongoClusterSamples.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.mongoclustertest.generated; + +/** + * Samples for FirewallRules ListByMongoCluster. + */ +public final class FirewallRulesListByMongoClusterSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.firewallRules().listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersCheckNameAvailabilitySamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..8f6861c0ba0ef --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersCheckNameAvailabilitySamples.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.mongoclustertest.generated; + +import com.azure.resourcemanager.mongoclustertest.models.CheckNameAvailabilityRequest; + +/** + * Samples for MongoClusters CheckNameAvailability. + */ +public final class MongoClustersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters() + .checkNameAvailabilityWithResponse("westus2", + new CheckNameAvailabilityRequest().withName("existingmongocluster") + .withType("Microsoft.DocumentDB/mongoClusters"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersCreateOrUpdateSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..961b3f1b522a1 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersCreateOrUpdateSamples.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.generated; + +import com.azure.resourcemanager.mongoclustertest.models.CreateMode; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterProperties; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterReplicaParameters; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterRestoreParameters; +import com.azure.resourcemanager.mongoclustertest.models.NodeGroupSpec; +import com.azure.resourcemanager.mongoclustertest.models.NodeKind; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for MongoClusters CreateOrUpdate. + */ +public final class MongoClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_CreateGeoReplica.json + */ + /** + * Sample code: Creates a replica Mongo Cluster resource from a source resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void createsAReplicaMongoClusterResourceFromASourceResource( + com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters() + .define("myReplicaMongoCluster") + .withRegion("centralus") + .withExistingResourceGroup("TestResourceGroup") + .withProperties(new MongoClusterProperties().withCreateMode(CreateMode.GEO_REPLICA) + .withReplicaParameters(new MongoClusterReplicaParameters().withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster") + .withSourceLocation("eastus"))) + .create(); + } + + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersDeleteSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersDeleteSamples.java new file mode 100644 index 0000000000000..7a0904e7b7b76 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersDeleteSamples.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.mongoclustertest.generated; + +/** + * Samples for MongoClusters Delete. + */ +public final class MongoClustersDeleteSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters().delete("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersGetByResourceGroupSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..6e362bd5f88ff --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersGetByResourceGroupSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.generated; + +/** + * Samples for MongoClusters GetByResourceGroup. + */ +public final class MongoClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListByResourceGroupSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..79705d8e355f2 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListByResourceGroupSamples.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.mongoclustertest.generated; + +/** + * Samples for MongoClusters ListByResourceGroup. + */ +public final class MongoClustersListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters().listByResourceGroup("TestResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListConnectionStringsSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListConnectionStringsSamples.java new file mode 100644 index 0000000000000..4d62e6c523600 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListConnectionStringsSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.generated; + +/** + * Samples for MongoClusters ListConnectionStrings. + */ +public final class MongoClustersListConnectionStringsSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters() + .listConnectionStringsWithResponse("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListSamples.java new file mode 100644 index 0000000000000..8a7d7b1e42b51 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersListSamples.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.mongoclustertest.generated; + +/** + * Samples for MongoClusters List. + */ +public final class MongoClustersListSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersPromoteSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersPromoteSamples.java new file mode 100644 index 0000000000000..d3bff035e47f7 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersPromoteSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.generated; + +import com.azure.resourcemanager.mongoclustertest.models.PromoteMode; +import com.azure.resourcemanager.mongoclustertest.models.PromoteOption; +import com.azure.resourcemanager.mongoclustertest.models.PromoteReplicaRequest; + +/** + * Samples for MongoClusters Promote. + */ +public final class MongoClustersPromoteSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_ForcePromoteReplica.json + */ + /** + * Sample code: Promotes a replica Mongo Cluster resource to a primary role. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void promotesAReplicaMongoClusterResourceToAPrimaryRole( + com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager) { + manager.mongoClusters() + .promote("TestGroup", "myMongoCluster", + new PromoteReplicaRequest().withPromoteOption(PromoteOption.FORCED).withMode(PromoteMode.SWITCHOVER), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersUpdateSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersUpdateSamples.java new file mode 100644 index 0000000000000..4c661f463c92b --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/MongoClustersUpdateSamples.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.mongoclustertest.generated; + +import com.azure.resourcemanager.mongoclustertest.models.MongoCluster; +import com.azure.resourcemanager.mongoclustertest.models.MongoClusterUpdateProperties; +import com.azure.resourcemanager.mongoclustertest.models.NodeGroupSpec; +import com.azure.resourcemanager.mongoclustertest.models.NodeKind; +import com.azure.resourcemanager.mongoclustertest.models.PublicNetworkAccess; +import java.util.Arrays; + +/** + * Samples for MongoClusters Update. + */ +public final class MongoClustersUpdateSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_ResetPassword.json + */ + /** + * Sample code: Resets the administrator login password. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void + resetsTheAdministratorLoginPassword(com.azure.resourcemanager.mongoclustertest.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")) + .apply(); + } + + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/OperationsListSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..03361af35037b --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/OperationsListSamples.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.mongoclustertest.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void operationsList(com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsCreateSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsCreateSamples.java new file mode 100644 index 0000000000000..3de1fb657a459 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsCreateSamples.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.mongoclustertest.generated; + +import com.azure.resourcemanager.mongoclustertest.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.mongoclustertest.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.mongoclustertest.models.PrivateLinkServiceConnectionState; + +/** + * Samples for PrivateEndpointConnections Create. + */ +public final class PrivateEndpointConnectionsCreateSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.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/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..fd3bf3c186546 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsDeleteSamples.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.mongoclustertest.generated; + +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.privateEndpointConnections() + .delete("TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..ed5476366a8fe --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsGetSamples.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.mongoclustertest.generated; + +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.privateEndpointConnections() + .getWithResponse("TestGroup", "myMongoCluster", "pecTest.5d393f64-ef64-46d0-9959-308321c44ac0", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java new file mode 100644 index 0000000000000..3cb111ae606a8 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongoclustertest.generated; + +/** + * Samples for PrivateEndpointConnections ListByMongoCluster. + */ +public final class PrivateEndpointConnectionsListByMongoClusterSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.privateEndpointConnections() + .listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateLinksListByMongoClusterSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateLinksListByMongoClusterSamples.java new file mode 100644 index 0000000000000..b13b2a3e43358 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/PrivateLinksListByMongoClusterSamples.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.mongoclustertest.generated; + +/** + * Samples for PrivateLinks ListByMongoCluster. + */ +public final class PrivateLinksListByMongoClusterSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-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.mongoclustertest.MongoClusterManager manager) { + manager.privateLinks().listByMongoCluster("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/ReplicasListByParentSamples.java b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/ReplicasListByParentSamples.java new file mode 100644 index 0000000000000..0bb7e4614adc7 --- /dev/null +++ b/sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/src/samples/java/com/azure/resourcemanager/mongoclustertest/generated/ReplicasListByParentSamples.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.mongoclustertest.generated; + +/** + * Samples for Replicas ListByParent. + */ +public final class ReplicasListByParentSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_ReplicaList.json + */ + /** + * Sample code: List the replicas linked to a Mongo Cluster resource. + * + * @param manager Entry point to MongoClusterManager. + */ + public static void listTheReplicasLinkedToAMongoClusterResource( + com.azure.resourcemanager.mongoclustertest.MongoClusterManager manager) { + manager.replicas().listByParent("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongoclustertest/ci.yml b/sdk/mongoclustertest/ci.yml new file mode 100644 index 0000000000000..528bbf955076d --- /dev/null +++ b/sdk/mongoclustertest/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/mongoclustertest/ci.yml + - sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/ + exclude: + - sdk/mongoclustertest/pom.xml + - sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mongoclustertest/ci.yml + - sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/ + exclude: + - sdk/mongoclustertest/pom.xml + - sdk/mongoclustertest/azure-resourcemanager-mongoclustertest/pom.xml + +parameters: + - name: release_azureresourcemanagermongoclustertest + displayName: azure-resourcemanager-mongoclustertest + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: mongoclustertest + Artifacts: + - name: azure-resourcemanager-mongoclustertest + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermongoclustertest + releaseInBatch: ${{ parameters.release_azureresourcemanagermongoclustertest }} diff --git a/sdk/mongoclustertest/pom.xml b/sdk/mongoclustertest/pom.xml new file mode 100644 index 0000000000000..8e7636ea0c0a9 --- /dev/null +++ b/sdk/mongoclustertest/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-mongoclustertest-service + pom + 1.0.0 + + + azure-resourcemanager-mongoclustertest + +