diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md b/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md index ca18d519ed771..6575c1e2c9a98 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2024-08-07) + +- Azure Resource Manager Mongo Cluster client library for Java. This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules. Package tag package-2024-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 diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md b/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md index 0c28919389d27..1faac878de5a6 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md @@ -2,7 +2,7 @@ Azure Resource Manager Mongo Cluster client library for Java. -This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules. Package tag package-2024-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 @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-mongocluster - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. -- `AZURE_CLIENT_ID` for Azure client ID. -- `AZURE_TENANT_ID` for Azure tenant ID. -- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. - -With above configuration, `azure` client can be authenticated using the following code: +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -97,6 +93,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [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 diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/SAMPLE.md b/sdk/mongocluster/azure-resourcemanager-mongocluster/SAMPLE.md index e5ea54fff25f9..e675cbd933207 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/SAMPLE.md +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/SAMPLE.md @@ -17,6 +17,7 @@ - [List](#mongoclusters_list) - [ListByResourceGroup](#mongoclusters_listbyresourcegroup) - [ListConnectionStrings](#mongoclusters_listconnectionstrings) +- [Promote](#mongoclusters_promote) - [Update](#mongoclusters_update) ## Operations @@ -33,6 +34,10 @@ ## PrivateLinks - [ListByMongoCluster](#privatelinks_listbymongocluster) + +## Replicas + +- [ListByParent](#replicas_listbyparent) ### FirewallRules_CreateOrUpdate ```java @@ -43,7 +48,8 @@ import com.azure.resourcemanager.mongocluster.models.FirewallRuleProperties; */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_FirewallRuleCreate.json */ /** @@ -71,7 +77,8 @@ public final class FirewallRulesCreateOrUpdateSamples { */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_FirewallRuleDelete.json */ /** @@ -94,7 +101,8 @@ public final class FirewallRulesDeleteSamples { */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_FirewallRuleGet.json */ /** @@ -118,7 +126,8 @@ public final class FirewallRulesGetSamples { */ public final class FirewallRulesListByMongoClusterSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_FirewallRuleList.json */ /** @@ -143,7 +152,8 @@ import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityReques */ public final class MongoClustersCheckNameAvailabilitySamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_NameAvailability.json */ /** @@ -157,15 +167,38 @@ public final class MongoClustersCheckNameAvailabilitySamples { .checkNameAvailabilityWithResponse("westus2", new CheckNameAvailabilityRequest().withName("newmongocluster") .withType("Microsoft.DocumentDB/mongoClusters"), com.azure.core.util.Context.NONE); } + + /* + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-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.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .checkNameAvailabilityWithResponse("westus2", + new CheckNameAvailabilityRequest().withName("existingmongocluster") + .withType("Microsoft.DocumentDB/mongoClusters"), + com.azure.core.util.Context.NONE); + } } ``` ### MongoClusters_CreateOrUpdate ```java +import com.azure.resourcemanager.mongocluster.models.CreateMode; import com.azure.resourcemanager.mongocluster.models.MongoClusterProperties; +import com.azure.resourcemanager.mongocluster.models.MongoClusterReplicaParameters; +import com.azure.resourcemanager.mongocluster.models.MongoClusterRestoreParameters; import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; import com.azure.resourcemanager.mongocluster.models.NodeKind; +import java.time.OffsetDateTime; import java.util.Arrays; /** @@ -174,8 +207,55 @@ import java.util.Arrays; public final class MongoClustersCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Create. - * json + * specification/mongocluster/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.mongocluster.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/mongocluster/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.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .define("myMongoCluster") + .withRegion("westus2") + .withExistingResourceGroup("TestResourceGroup") + .withProperties(new MongoClusterProperties().withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withRestoreParameters(new MongoClusterRestoreParameters() + .withPointInTimeUtc(OffsetDateTime.parse("2023-01-13T20:07:35Z")) + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster"))) + .create(); + } + + /* + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_Create.json */ /** * Sample code: Creates a new Mongo Cluster resource. @@ -210,8 +290,8 @@ public final class MongoClustersCreateOrUpdateSamples { public final class MongoClustersDeleteSamples { /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Delete. - * json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_Delete.json */ /** * Sample code: Deletes a Mongo Cluster resource. @@ -234,7 +314,8 @@ public final class MongoClustersDeleteSamples { public final class MongoClustersGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Get.json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_Get.json */ /** * Sample code: Gets a Mongo Cluster resource. @@ -257,7 +338,8 @@ public final class MongoClustersGetByResourceGroupSamples { public final class MongoClustersListSamples { /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_List.json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_List.json */ /** * Sample code: Lists the Mongo Cluster resources in a subscription. @@ -279,7 +361,8 @@ public final class MongoClustersListSamples { */ public final class MongoClustersListByResourceGroupSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_ListByResourceGroup.json */ /** @@ -302,7 +385,8 @@ public final class MongoClustersListByResourceGroupSamples { */ public final class MongoClustersListConnectionStringsSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_ListConnectionStrings.json */ /** @@ -318,6 +402,37 @@ public final class MongoClustersListConnectionStringsSamples { } ``` +### MongoClusters_Promote + +```java +import com.azure.resourcemanager.mongocluster.models.PromoteMode; +import com.azure.resourcemanager.mongocluster.models.PromoteOption; +import com.azure.resourcemanager.mongocluster.models.PromoteReplicaRequest; + +/** + * Samples for MongoClusters Promote. + */ +public final class MongoClustersPromoteSamples { + /* + * x-ms-original-file: + * specification/mongocluster/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.mongocluster.MongoClusterManager manager) { + manager.mongoClusters() + .promote("TestGroup", "myMongoCluster", + new PromoteReplicaRequest().withPromoteOption(PromoteOption.FORCED).withMode(PromoteMode.SWITCHOVER), + com.azure.core.util.Context.NONE); + } +} +``` + ### MongoClusters_Update ```java @@ -325,6 +440,7 @@ import com.azure.resourcemanager.mongocluster.models.MongoCluster; import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdateProperties; import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; import com.azure.resourcemanager.mongocluster.models.NodeKind; +import com.azure.resourcemanager.mongocluster.models.PublicNetworkAccess; import java.util.Arrays; /** @@ -332,7 +448,29 @@ import java.util.Arrays; */ public final class MongoClustersUpdateSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/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.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties().withAdministratorLogin("mongoAdmin") + .withAdministratorLoginPassword("fakeTokenPlaceholder")) + .apply(); + } + + /* + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PatchDiskSize.json */ /** @@ -350,6 +488,54 @@ public final class MongoClustersUpdateSamples { .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withDiskSizeGB(256L).withKind(NodeKind.SHARD)))) .apply(); } + + /* + * x-ms-original-file: + * specification/mongocluster/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.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties().withPublicNetworkAccess(PublicNetworkAccess.DISABLED)) + .apply(); + } + + /* + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-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.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties().withAdministratorLogin("mongoAdmin") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withServerVersion("5.0") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withSku("M50") + .withDiskSizeGB(256L) + .withEnableHa(true) + .withKind(NodeKind.SHARD) + .withNodeCount(1)))) + .apply(); + } } ``` @@ -362,7 +548,8 @@ public final class MongoClustersUpdateSamples { public final class OperationsListSamples { /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/Operations_List.json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * Operations_List.json */ /** * Sample code: Operations_List. @@ -387,7 +574,8 @@ import com.azure.resourcemanager.mongocluster.models.PrivateLinkServiceConnectio */ public final class PrivateEndpointConnectionsCreateSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateEndpointConnectionPut.json */ /** @@ -416,7 +604,8 @@ public final class PrivateEndpointConnectionsCreateSamples { */ public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateEndpointConnectionDelete.json */ /** @@ -441,7 +630,8 @@ public final class PrivateEndpointConnectionsDeleteSamples { */ public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateEndpointConnectionGet.json */ /** @@ -466,7 +656,8 @@ public final class PrivateEndpointConnectionsGetSamples { */ public final class PrivateEndpointConnectionsListByMongoClusterSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateEndpointConnectionList.json */ /** @@ -490,7 +681,8 @@ public final class PrivateEndpointConnectionsListByMongoClusterSamples { */ public final class PrivateLinksListByMongoClusterSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateLinkResourceList.json */ /** @@ -505,3 +697,27 @@ public final class PrivateLinksListByMongoClusterSamples { } ``` +### Replicas_ListByParent + +```java +/** + * Samples for Replicas ListByParent. + */ +public final class ReplicasListByParentSamples { + /* + * x-ms-original-file: + * specification/mongocluster/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.mongocluster.MongoClusterManager manager) { + manager.replicas().listByParent("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml b/sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml index fce1eee0208ff..9653be6eaed01 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/pom.xml @@ -1,7 +1,7 @@ 4.0.0 @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for Mongo Cluster Management - This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules. + This package contains Microsoft Azure SDK for Mongo Cluster Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure Cosmos DB for MongoDB vCore resources including clusters and firewall rules. Package tag package-2024-06-01-preview. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/MongoClusterManager.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/MongoClusterManager.java index b141707957b89..9f52c0f7b4954 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/MongoClusterManager.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/MongoClusterManager.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster; @@ -23,18 +23,20 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.mongocluster.fluent.DocumentDBClient; -import com.azure.resourcemanager.mongocluster.implementation.DocumentDBClientBuilder; +import com.azure.resourcemanager.mongocluster.fluent.MongoClusterManagementClient; import com.azure.resourcemanager.mongocluster.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.mongocluster.implementation.MongoClusterManagementClientBuilder; import com.azure.resourcemanager.mongocluster.implementation.MongoClustersImpl; import com.azure.resourcemanager.mongocluster.implementation.OperationsImpl; import com.azure.resourcemanager.mongocluster.implementation.PrivateEndpointConnectionsImpl; import com.azure.resourcemanager.mongocluster.implementation.PrivateLinksImpl; +import com.azure.resourcemanager.mongocluster.implementation.ReplicasImpl; import com.azure.resourcemanager.mongocluster.models.FirewallRules; import com.azure.resourcemanager.mongocluster.models.MongoClusters; import com.azure.resourcemanager.mongocluster.models.Operations; import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnections; import com.azure.resourcemanager.mongocluster.models.PrivateLinks; +import com.azure.resourcemanager.mongocluster.models.Replicas; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -58,12 +60,14 @@ public final class MongoClusterManager { private PrivateLinks privateLinks; - private final DocumentDBClient clientObject; + 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 DocumentDBClientBuilder().pipeline(httpPipeline) + this.clientObject = new MongoClusterManagementClientBuilder().pipeline(httpPipeline) .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) .subscriptionId(profile.getSubscriptionId()) .defaultPollInterval(defaultPollInterval) @@ -330,12 +334,24 @@ public PrivateLinks privateLinks() { } /** - * Gets wrapped service client DocumentDBClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * 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 DocumentDBClient. + * @return Wrapped service client MongoClusterManagementClient. */ - public DocumentDBClient serviceClient() { + public MongoClusterManagementClient serviceClient() { return this.clientObject; } } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/FirewallRulesClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/FirewallRulesClient.java index 26dadf543722d..33b3167997ade 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/FirewallRulesClient.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/FirewallRulesClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent; @@ -17,6 +17,34 @@ * 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. * @@ -170,32 +198,4 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String mongoClusterName, String firewallRuleName, 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 com.azure.core.management.exception.ManagementException 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); } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/DocumentDBClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClusterManagementClient.java similarity index 82% rename from sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/DocumentDBClient.java rename to sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClusterManagementClient.java index 38bdf7114dcf6..e232bc4170416 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/DocumentDBClient.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClusterManagementClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent; @@ -8,29 +8,29 @@ import java.time.Duration; /** - * The interface for DocumentDBClient class. + * The interface for MongoClusterManagementClient class. */ -public interface DocumentDBClient { +public interface MongoClusterManagementClient { /** - * Gets Server parameter. + * Gets The ID of the target subscription. The value must be an UUID. * - * @return the endpoint value. + * @return the subscriptionId value. */ - String getEndpoint(); + String getSubscriptionId(); /** - * Gets Version parameter. + * Gets server parameter. * - * @return the apiVersion value. + * @return the endpoint value. */ - String getApiVersion(); + String getEndpoint(); /** - * Gets The ID of the target subscription. The value must be an UUID. + * Gets Api Version. * - * @return the subscriptionId value. + * @return the apiVersion value. */ - String getSubscriptionId(); + String getApiVersion(); /** * Gets The HTTP pipeline to send requests through. @@ -80,4 +80,11 @@ public interface DocumentDBClient { * @return the PrivateLinksClient object. */ PrivateLinksClient getPrivateLinks(); + + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + ReplicasClient getReplicas(); } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClustersClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClustersClient.java index 5ce7b73048a1b..b70400a65bc21 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClustersClient.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/MongoClustersClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent; @@ -16,11 +16,87 @@ import com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner; import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdate; +import com.azure.resourcemanager.mongocluster.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. * @@ -232,107 +308,90 @@ MongoClusterInner update(String resourceGroupName, String mongoClusterName, Mong void delete(String resourceGroupName, String mongoClusterName, Context context); /** - * List all the mongo clusters in a given resource group. + * 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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + * @return the connection strings for the given mongo cluster along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConnectionStringsWithResponse(String resourceGroupName, + String mongoClusterName, Context context); /** - * List all the mongo clusters in a given resource group. + * 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 context The context to associate with this operation. + * @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 MongoCluster list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); - - /** - * 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}. + * @return the connection strings for the given mongo cluster. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + ListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String mongoClusterName); /** - * List all the mongo clusters in a given subscription. + * Promotes a replica mongo cluster to a primary role. * - * @param context The context to associate with this operation. + * @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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body); /** - * 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. + * 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 connection strings for the given mongo cluster along with {@link Response}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response listConnectionStringsWithResponse(String resourceGroupName, - String mongoClusterName, Context context); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body, 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. + * 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 connection strings for the given mongo cluster. */ @ServiceMethod(returns = ReturnType.SINGLE) - ListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String mongoClusterName); + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body); /** - * Check if mongo cluster name is available for use. + * Promotes a replica mongo cluster to a primary role. * - * @param location The location name. - * @param body The CheckAvailability request. + * @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 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 location name. - * @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); + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, Context context); } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/OperationsClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/OperationsClient.java index fc74d29eef1cb..7dfcdbb7fc7fe 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/OperationsClient.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/OperationsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateEndpointConnectionsClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateEndpointConnectionsClient.java index afaa0178d1a10..bdeeba124dfc0 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateEndpointConnectionsClient.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateEndpointConnectionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent; @@ -92,7 +92,8 @@ PrivateEndpointConnectionResourceInner get(String resourceGroupName, String mong * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @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( @@ -111,7 +112,8 @@ SyncPoller, PrivateEndpointCo * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @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( @@ -129,7 +131,7 @@ SyncPoller, PrivateEndpointCo * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @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, @@ -147,7 +149,7 @@ PrivateEndpointConnectionResourceInner create(String resourceGroupName, String m * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @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, diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateLinksClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateLinksClient.java index 8779553179b88..08d23b4984e77 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateLinksClient.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/PrivateLinksClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/ReplicasClient.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/ReplicasClient.java new file mode 100644 index 0000000000000..5f503b35c69cb --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mongocluster.fluent.models.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/CheckNameAvailabilityResponseInner.java index 4e3682130046d..aa1dc0d485acb 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/CheckNameAvailabilityResponseInner.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/CheckNameAvailabilityResponseInner.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -15,7 +15,7 @@ /** * The check availability result. */ -@Immutable +@Fluent public final class CheckNameAvailabilityResponseInner implements JsonSerializable { /* * Indicates if the resource name is available. @@ -28,14 +28,14 @@ public final class CheckNameAvailabilityResponseInner implements JsonSerializabl private CheckNameAvailabilityReason reason; /* - * Detailed reason why the given name is not available. + * Detailed reason why the given name is available. */ private String message; /** * Creates an instance of CheckNameAvailabilityResponseInner class. */ - private CheckNameAvailabilityResponseInner() { + public CheckNameAvailabilityResponseInner() { } /** @@ -47,6 +47,17 @@ 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. * @@ -57,7 +68,18 @@ public CheckNameAvailabilityReason reason() { } /** - * Get the message property: Detailed reason why the given name is not available. + * 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. */ @@ -65,6 +87,17 @@ 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. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/FirewallRuleInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/FirewallRuleInner.java index 18de0706ef34a..ccbbc0ecfd6da 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/FirewallRuleInner.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/FirewallRuleInner.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ListConnectionStringsResultInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ListConnectionStringsResultInner.java index 7070e9205a959..c3fc8c92a1dd4 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ListConnectionStringsResultInner.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ListConnectionStringsResultInner.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent.models; @@ -26,7 +26,7 @@ public final class ListConnectionStringsResultInner implements JsonSerializable< /** * Creates an instance of ListConnectionStringsResultInner class. */ - private ListConnectionStringsResultInner() { + public ListConnectionStringsResultInner() { } /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/MongoClusterInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/MongoClusterInner.java index 5720c3558a3de..3ba6763a166b5 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/MongoClusterInner.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/MongoClusterInner.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/OperationInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/OperationInner.java index 5fc4c39f43b33..51c621cd1a8c1 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/OperationInner.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/OperationInner.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -15,9 +15,11 @@ import java.io.IOException; /** + * REST API Operation + * * Details of a REST API operation, returned from the Resource Provider Operations API. */ -@Immutable +@Fluent public final class OperationInner implements JsonSerializable { /* * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: @@ -26,8 +28,8 @@ public final class OperationInner implements JsonSerializable { private String name; /* - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure - * Resource Manager/control-plane operations. + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. */ private Boolean isDataAction; @@ -43,14 +45,14 @@ public final class OperationInner implements JsonSerializable { private Origin origin; /* - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ private ActionType actionType; /** * Creates an instance of OperationInner class. */ - private OperationInner() { + public OperationInner() { } /** @@ -65,7 +67,7 @@ public String name() { /** * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane - * operations and "false" for Azure Resource Manager/control-plane operations. + * operations and "false" for ARM/control-plane operations. * * @return the isDataAction value. */ @@ -82,6 +84,17 @@ 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". @@ -93,8 +106,8 @@ public Origin origin() { } /** - * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are - * for internal only APIs. + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. * * @return the actionType value. */ @@ -119,7 +132,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("actionType", this.actionType == null ? null : this.actionType.toString()); + jsonWriter.writeJsonField("display", this.display); return jsonWriter.writeEndObject(); } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateEndpointConnectionResourceInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateEndpointConnectionResourceInner.java index 181255cc2393d..99abe724a6960 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateEndpointConnectionResourceInner.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateEndpointConnectionResourceInner.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateLinkResourceInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateLinkResourceInner.java index e5b9c58b51c16..e97b73febb0a8 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateLinkResourceInner.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/PrivateLinkResourceInner.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.fluent.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.json.JsonReader; @@ -16,7 +16,7 @@ /** * Concrete proxy resource types can be created by aliasing this type using a specific property type. */ -@Immutable +@Fluent public final class PrivateLinkResourceInner extends ProxyResource { /* * The resource-specific properties for this resource. @@ -46,7 +46,7 @@ public final class PrivateLinkResourceInner extends ProxyResource { /** * Creates an instance of PrivateLinkResourceInner class. */ - private PrivateLinkResourceInner() { + public PrivateLinkResourceInner() { } /** @@ -58,6 +58,17 @@ 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. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ReplicaInner.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ReplicaInner.java new file mode 100644 index 0000000000000..a1bd75306deea --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/package-info.java index c5de4d0cfd262..8119c68b4f314 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/package-info.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/package-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. /** * Package containing the inner data models for MongoClusterManagementClient. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/package-info.java index ca90018d82028..64a699badc4bc 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/package-info.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/package-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. /** * Package containing the service clients for MongoClusterManagementClient. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/CheckNameAvailabilityResponseImpl.java index ba97ed3f859cd..90bcd142f8014 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/CheckNameAvailabilityResponseImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/CheckNameAvailabilityResponseImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRuleImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRuleImpl.java index 3b33a5bc74650..7bc9503b6a4ec 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRuleImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRuleImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesClientImpl.java index 3e134773a7585..d87e932a1f1f9 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesClientImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -33,7 +33,7 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.mongocluster.fluent.FirewallRulesClient; import com.azure.resourcemanager.mongocluster.fluent.models.FirewallRuleInner; -import com.azure.resourcemanager.mongocluster.implementation.models.FirewallRuleListResult; +import com.azure.resourcemanager.mongocluster.models.FirewallRuleListResult; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -50,67 +50,68 @@ public final class FirewallRulesClientImpl implements FirewallRulesClient { /** * The service client containing this operation class. */ - private final DocumentDBClientImpl client; + private final MongoClusterManagementClientImpl client; /** * Initializes an instance of FirewallRulesClientImpl. * * @param client the instance of the service client containing this operation class. */ - FirewallRulesClientImpl(DocumentDBClientImpl client) { + FirewallRulesClientImpl(MongoClusterManagementClientImpl client) { this.service = RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for DocumentDBClientFirewallRules to be used by the proxy service to - * perform REST calls. + * The interface defining all the services for MongoClusterManagementClientFirewallRules to be used by the proxy + * service to perform REST calls. */ - @Host("{endpoint}") - @ServiceInterface(name = "DocumentDBClientFire") + @Host("{$host}") + @ServiceInterface(name = "MongoClusterManageme") public interface FirewallRulesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, + Mono> listByMongoCluster(@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, + @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}/firewallRules/{firewallRuleName}") - @ExpectedResponses({ 200, 201, 202 }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + 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, - @BodyParam("application/json") FirewallRuleInner resource, Context context); + @PathParam("firewallRuleName") String firewallRuleName, @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 }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({ 200, 201, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("endpoint") String endpoint, + 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, @HeaderParam("accept") String accept, + @PathParam("firewallRuleName") String firewallRuleName, + @BodyParam("application/json") FirewallRuleInner resource, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules") - @ExpectedResponses({ 200 }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({ 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByMongoCluster(@HostParam("endpoint") String endpoint, + 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, + @PathParam("mongoClusterName") String mongoClusterName, + @PathParam("firewallRuleName") String firewallRuleName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -118,8 +119,153 @@ Mono> listByMongoCluster(@HostParam("endpoint") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByMongoClusterNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, Context context); + @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)); } /** @@ -301,8 +447,8 @@ private Mono>> createOrUpdateWithResponseAsync(String final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, firewallRuleName, accept, - resource, context)) + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, firewallRuleName, resource, + accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -351,7 +497,7 @@ private Mono>> createOrUpdateWithResponseAsync(String 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, accept, resource, + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, firewallRuleName, resource, accept, context); } @@ -740,151 +886,6 @@ public void delete(String resourceGroupName, String mongoClusterName, String fir deleteAsync(resourceGroupName, mongoClusterName, firewallRuleName, context).block(); } - /** - * 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)); - } - /** * Get the next page of items. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesImpl.java index 6b408ab3abcab..bf7429a12ef28 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/FirewallRulesImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -27,6 +27,19 @@ public FirewallRulesImpl(FirewallRulesClient 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 @@ -56,19 +69,6 @@ public void delete(String resourceGroupName, String mongoClusterName, String fir this.serviceClient().delete(resourceGroupName, mongoClusterName, firewallRuleName, context); } - 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 FirewallRule getById(String id) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ListConnectionStringsResultImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ListConnectionStringsResultImpl.java index 25f607d90a2c0..0539a25b12c4b 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ListConnectionStringsResultImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ListConnectionStringsResultImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterImpl.java index 3d98b5b6312d9..d2cf3d7f8b5d0 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -14,6 +14,7 @@ import com.azure.resourcemanager.mongocluster.models.MongoClusterProperties; import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdate; import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdateProperties; +import com.azure.resourcemanager.mongocluster.models.PromoteReplicaRequest; import java.util.Collections; import java.util.Map; @@ -158,6 +159,14 @@ 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; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/DocumentDBClientBuilder.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientBuilder.java similarity index 63% rename from sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/DocumentDBClientBuilder.java rename to sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientBuilder.java index 899aa78dc1266..8a82732985455 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/DocumentDBClientBuilder.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientBuilder.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -15,39 +15,39 @@ import java.time.Duration; /** - * A builder for creating a new instance of the DocumentDBClientImpl type. + * A builder for creating a new instance of the MongoClusterManagementClientImpl type. */ -@ServiceClientBuilder(serviceClients = { DocumentDBClientImpl.class }) -public final class DocumentDBClientBuilder { +@ServiceClientBuilder(serviceClients = { MongoClusterManagementClientImpl.class }) +public final class MongoClusterManagementClientBuilder { /* - * Server parameter + * The ID of the target subscription. The value must be an UUID. */ - private String endpoint; + private String subscriptionId; /** - * Sets Server parameter. + * Sets The ID of the target subscription. The value must be an UUID. * - * @param endpoint the endpoint value. - * @return the DocumentDBClientBuilder. + * @param subscriptionId the subscriptionId value. + * @return the MongoClusterManagementClientBuilder. */ - public DocumentDBClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; + public MongoClusterManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; return this; } /* - * The ID of the target subscription. The value must be an UUID. + * server parameter */ - private String subscriptionId; + private String endpoint; /** - * Sets The ID of the target subscription. The value must be an UUID. + * Sets server parameter. * - * @param subscriptionId the subscriptionId value. - * @return the DocumentDBClientBuilder. + * @param endpoint the endpoint value. + * @return the MongoClusterManagementClientBuilder. */ - public DocumentDBClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; + public MongoClusterManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } @@ -60,9 +60,9 @@ public DocumentDBClientBuilder subscriptionId(String subscriptionId) { * Sets The environment to connect to. * * @param environment the environment value. - * @return the DocumentDBClientBuilder. + * @return the MongoClusterManagementClientBuilder. */ - public DocumentDBClientBuilder environment(AzureEnvironment environment) { + public MongoClusterManagementClientBuilder environment(AzureEnvironment environment) { this.environment = environment; return this; } @@ -76,9 +76,9 @@ public DocumentDBClientBuilder environment(AzureEnvironment environment) { * Sets The HTTP pipeline to send requests through. * * @param pipeline the pipeline value. - * @return the DocumentDBClientBuilder. + * @return the MongoClusterManagementClientBuilder. */ - public DocumentDBClientBuilder pipeline(HttpPipeline pipeline) { + public MongoClusterManagementClientBuilder pipeline(HttpPipeline pipeline) { this.pipeline = pipeline; return this; } @@ -92,9 +92,9 @@ public DocumentDBClientBuilder pipeline(HttpPipeline pipeline) { * Sets The default poll interval for long-running operation. * * @param defaultPollInterval the defaultPollInterval value. - * @return the DocumentDBClientBuilder. + * @return the MongoClusterManagementClientBuilder. */ - public DocumentDBClientBuilder defaultPollInterval(Duration defaultPollInterval) { + public MongoClusterManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { this.defaultPollInterval = defaultPollInterval; return this; } @@ -108,19 +108,20 @@ public DocumentDBClientBuilder defaultPollInterval(Duration defaultPollInterval) * Sets The serializer to serialize an object into a string. * * @param serializerAdapter the serializerAdapter value. - * @return the DocumentDBClientBuilder. + * @return the MongoClusterManagementClientBuilder. */ - public DocumentDBClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + public MongoClusterManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { this.serializerAdapter = serializerAdapter; return this; } /** - * Builds an instance of DocumentDBClientImpl with the provided parameters. + * Builds an instance of MongoClusterManagementClientImpl with the provided parameters. * - * @return an instance of DocumentDBClientImpl. + * @return an instance of MongoClusterManagementClientImpl. */ - public DocumentDBClientImpl buildClient() { + public MongoClusterManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; HttpPipeline localPipeline = (pipeline != null) ? pipeline @@ -130,8 +131,8 @@ public DocumentDBClientImpl buildClient() { SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter : SerializerFactory.createDefaultManagementSerializerAdapter(); - DocumentDBClientImpl client = new DocumentDBClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, this.endpoint, this.subscriptionId); + MongoClusterManagementClientImpl client = new MongoClusterManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); return client; } } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/DocumentDBClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientImpl.java similarity index 89% rename from sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/DocumentDBClientImpl.java rename to sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientImpl.java index 8175c14c61ea3..ff05b1eeef536 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/DocumentDBClientImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClusterManagementClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -23,12 +23,13 @@ import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.mongocluster.fluent.DocumentDBClient; import com.azure.resourcemanager.mongocluster.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mongocluster.fluent.MongoClusterManagementClient; import com.azure.resourcemanager.mongocluster.fluent.MongoClustersClient; import com.azure.resourcemanager.mongocluster.fluent.OperationsClient; import com.azure.resourcemanager.mongocluster.fluent.PrivateEndpointConnectionsClient; import com.azure.resourcemanager.mongocluster.fluent.PrivateLinksClient; +import com.azure.resourcemanager.mongocluster.fluent.ReplicasClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -39,50 +40,50 @@ import reactor.core.publisher.Mono; /** - * Initializes a new instance of the DocumentDBClientImpl type. + * Initializes a new instance of the MongoClusterManagementClientImpl type. */ -@ServiceClient(builder = DocumentDBClientBuilder.class) -public final class DocumentDBClientImpl implements DocumentDBClient { +@ServiceClient(builder = MongoClusterManagementClientBuilder.class) +public final class MongoClusterManagementClientImpl implements MongoClusterManagementClient { /** - * Server parameter. + * The ID of the target subscription. The value must be an UUID. */ - private final String endpoint; + private final String subscriptionId; /** - * Gets Server parameter. + * Gets The ID of the target subscription. The value must be an UUID. * - * @return the endpoint value. + * @return the subscriptionId value. */ - public String getEndpoint() { - return this.endpoint; + public String getSubscriptionId() { + return this.subscriptionId; } /** - * Version parameter. + * server parameter. */ - private final String apiVersion; + private final String endpoint; /** - * Gets Version parameter. + * Gets server parameter. * - * @return the apiVersion value. + * @return the endpoint value. */ - public String getApiVersion() { - return this.apiVersion; + public String getEndpoint() { + return this.endpoint; } /** - * The ID of the target subscription. The value must be an UUID. + * Api Version. */ - private final String subscriptionId; + private final String apiVersion; /** - * Gets The ID of the target subscription. The value must be an UUID. + * Gets Api Version. * - * @return the subscriptionId value. + * @return the apiVersion value. */ - public String getSubscriptionId() { - return this.subscriptionId; + public String getApiVersion() { + return this.apiVersion; } /** @@ -198,28 +199,43 @@ public PrivateLinksClient getPrivateLinks() { } /** - * Initializes an instance of DocumentDBClient client. + * 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 endpoint Server parameter. * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param endpoint server parameter. */ - DocumentDBClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String endpoint, String subscriptionId) { + MongoClusterManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; this.subscriptionId = subscriptionId; - this.apiVersion = "2024-03-01-preview"; + 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); } /** @@ -348,5 +364,5 @@ public Mono getBodyAsString(Charset charset) { } } - private static final ClientLogger LOGGER = new ClientLogger(DocumentDBClientImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(MongoClusterManagementClientImpl.class); } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersClientImpl.java index ffb13c2e0c573..021b0228b3965 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersClientImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -37,9 +37,10 @@ import com.azure.resourcemanager.mongocluster.fluent.models.CheckNameAvailabilityResponseInner; import com.azure.resourcemanager.mongocluster.fluent.models.ListConnectionStringsResultInner; import com.azure.resourcemanager.mongocluster.fluent.models.MongoClusterInner; -import com.azure.resourcemanager.mongocluster.implementation.models.MongoClusterListResult; import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.mongocluster.models.MongoClusterListResult; import com.azure.resourcemanager.mongocluster.models.MongoClusterUpdate; +import com.azure.resourcemanager.mongocluster.models.PromoteReplicaRequest; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -56,116 +57,487 @@ public final class MongoClustersClientImpl implements MongoClustersClient { /** * The service client containing this operation class. */ - private final DocumentDBClientImpl client; + private final MongoClusterManagementClientImpl client; /** * Initializes an instance of MongoClustersClientImpl. * * @param client the instance of the service client containing this operation class. */ - MongoClustersClientImpl(DocumentDBClientImpl client) { + MongoClustersClientImpl(MongoClusterManagementClientImpl client) { this.service = RestProxy.create(MongoClustersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for DocumentDBClientMongoClusters to be used by the proxy service to - * perform REST calls. + * The interface defining all the services for MongoClusterManagementClientMongoClusters to be used by the proxy + * service to perform REST calls. */ - @Host("{endpoint}") - @ServiceInterface(name = "DocumentDBClientMong") + @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("endpoint") String endpoint, + 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, + @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("endpoint") String endpoint, + Mono>> createOrUpdate(@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, - @BodyParam("application/json") MongoClusterInner resource, Context context); + @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("endpoint") String endpoint, + Mono>> update(@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, - @BodyParam("application/json") MongoClusterUpdate properties, Context context); + @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("endpoint") String endpoint, + 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, + @PathParam("mongoClusterName") String mongoClusterName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters") + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/listConnectionStrings") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + Mono> listConnectionStrings(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("accept") String accept, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("mongoClusterName") String mongoClusterName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters") - @ExpectedResponses({ 200 }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/promote") + @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/listConnectionStrings") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listConnectionStrings(@HostParam("endpoint") String endpoint, + Mono>> promote(@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, + @PathParam("mongoClusterName") String mongoClusterName, + @BodyParam("application/json") PromoteReplicaRequest body, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/checkMongoClusterNameAvailability") + @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> checkNameAvailability(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @HeaderParam("accept") String accept, - @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); + 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("endpoint") String endpoint, - @HeaderParam("accept") String accept, Context context); + @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)); + } - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("accept") String accept, 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 ManagementException 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)); } /** @@ -327,7 +699,7 @@ private Mono>> createOrUpdateWithResponseAsync(String final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, accept, resource, context)) + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, resource, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -371,7 +743,7 @@ private Mono>> createOrUpdateWithResponseAsync(String final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, accept, resource, context); + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, resource, accept, context); } /** @@ -570,7 +942,7 @@ private Mono>> updateWithResponseAsync(String resource final String accept = "application/json"; return FluxUtil .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, accept, properties, context)) + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, properties, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -614,7 +986,7 @@ private Mono>> updateWithResponseAsync(String resource final String accept = "application/json"; context = this.client.mergeContext(context); return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, mongoClusterName, accept, properties, context); + resourceGroupName, mongoClusterName, properties, accept, context); } /** @@ -890,327 +1262,90 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 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)); - } - - /** - * 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}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @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())); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String mongoClusterName) { + return this.beginDeleteAsync(resourceGroupName, mongoClusterName).getSyncPoller(); } /** - * List all the mongo clusters in a given subscription. + * 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 response of a MongoCluster list operation along with {@link PagedResponse} on successful completion - * of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @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)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String mongoClusterName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, mongoClusterName, context).getSyncPoller(); } /** - * List all the mongo clusters in a given subscription. + * 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 response of a MongoCluster list operation as paginated response with {@link PagedFlux}. + * @return A {@link Mono} that completes when a successful response is received. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String mongoClusterName) { + return beginDeleteAsync(resourceGroupName, mongoClusterName).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * List all the mongo clusters in a given subscription. + * 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 response of a MongoCluster list operation as paginated response with {@link PagedFlux}. + * @return A {@link Mono} that completes when a successful response is received. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String mongoClusterName, Context context) { + return beginDeleteAsync(resourceGroupName, mongoClusterName, context).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * List all the mongo clusters in a given subscription. + * 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 response of a MongoCluster list operation as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String mongoClusterName) { + deleteAsync(resourceGroupName, mongoClusterName).block(); } /** - * List all the mongo clusters in a given subscription. + * 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 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)); + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String mongoClusterName, Context context) { + deleteAsync(resourceGroupName, mongoClusterName, context).block(); } /** @@ -1343,18 +1478,19 @@ public ListConnectionStringsResultInner listConnectionStrings(String resourceGro } /** - * Check if mongo cluster name is available for use. + * Promotes a replica mongo cluster to a primary role. * - * @param location The location name. - * @param body The CheckAvailability request. + * @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 check availability result along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> checkNameAvailabilityWithResponseAsync(String location, - CheckNameAvailabilityRequest body) { + 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.")); @@ -1363,8 +1499,13 @@ private Mono> checkNameAvailability 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 (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.")); @@ -1373,25 +1514,26 @@ private Mono> checkNameAvailability } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.checkNameAvailability(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), location, accept, body, context)) + .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())); } /** - * Check if mongo cluster name is available for use. + * Promotes a replica mongo cluster to a primary role. * - * @param location The location name. - * @param body The CheckAvailability request. + * @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 check availability result along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> checkNameAvailabilityWithResponseAsync(String location, - CheckNameAvailabilityRequest body, Context context) { + 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.")); @@ -1400,8 +1542,13 @@ private Mono> checkNameAvailability 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 (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.")); @@ -1410,57 +1557,152 @@ private Mono> checkNameAvailability } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.checkNameAvailability(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, accept, body, context); + return service.promote(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, body, accept, context); } /** - * Check if mongo cluster name is available for use. + * Promotes a replica mongo cluster to a primary role. * - * @param location The location name. - * @param body The CheckAvailability request. + * @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 check availability result on successful completion of {@link Mono}. + * @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 checkNameAvailabilityAsync(String location, - CheckNameAvailabilityRequest body) { - return checkNameAvailabilityWithResponseAsync(location, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono promoteAsync(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body) { + return beginPromoteAsync(resourceGroupName, mongoClusterName, body).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Check if mongo cluster name is available for use. + * Promotes a replica mongo cluster to a primary role. * - * @param location The location name. - * @param body The CheckAvailability request. + * @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 check availability result along with {@link Response}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response checkNameAvailabilityWithResponse(String location, - CheckNameAvailabilityRequest body, Context context) { - return checkNameAvailabilityWithResponseAsync(location, body, context).block(); + private Mono promoteAsync(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, + Context context) { + return beginPromoteAsync(resourceGroupName, mongoClusterName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Check if mongo cluster name is available for use. + * Promotes a replica mongo cluster to a primary role. * - * @param location The location name. - * @param body The CheckAvailability request. + * @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 check availability result. */ @ServiceMethod(returns = ReturnType.SINGLE) - public CheckNameAvailabilityResponseInner checkNameAvailability(String location, - CheckNameAvailabilityRequest body) { - return checkNameAvailabilityWithResponse(location, body, Context.NONE).getValue(); + 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(); } /** @@ -1474,7 +1716,7 @@ public CheckNameAvailabilityResponseInner checkNameAvailability(String location, * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1483,9 +1725,7 @@ private Mono> listByResourceGroupNextSinglePage 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)) + 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())); @@ -1503,8 +1743,7 @@ private Mono> listByResourceGroupNextSinglePage * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, - Context context) { + private Mono> listNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1514,7 +1753,7 @@ private Mono> listByResourceGroupNextSinglePage } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, 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)); } @@ -1530,7 +1769,7 @@ private Mono> listByResourceGroupNextSinglePage * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1539,7 +1778,9 @@ private Mono> listNextSinglePageAsync(String ne 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)) + 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())); @@ -1557,7 +1798,8 @@ private Mono> listNextSinglePageAsync(String ne * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1567,7 +1809,7 @@ private Mono> listNextSinglePageAsync(String ne } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersImpl.java index 47a86627a3593..403396219d377 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -18,6 +18,7 @@ import com.azure.resourcemanager.mongocluster.models.ListConnectionStringsResult; import com.azure.resourcemanager.mongocluster.models.MongoCluster; import com.azure.resourcemanager.mongocluster.models.MongoClusters; +import com.azure.resourcemanager.mongocluster.models.PromoteReplicaRequest; public final class MongoClustersImpl implements MongoClusters { private static final ClientLogger LOGGER = new ClientLogger(MongoClustersImpl.class); @@ -32,33 +33,35 @@ public MongoClustersImpl(MongoClustersClient innerClient, this.serviceManager = serviceManager; } - public Response getByResourceGroupWithResponse(String resourceGroupName, String mongoClusterName, - Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, mongoClusterName, context); + 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 MongoClusterImpl(inner.getValue(), this.manager())); + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); } else { return null; } } - public MongoCluster getByResourceGroup(String resourceGroupName, String mongoClusterName) { - MongoClusterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, mongoClusterName); + public CheckNameAvailabilityResponse checkNameAvailability(String location, CheckNameAvailabilityRequest body) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkNameAvailability(location, body); if (inner != null) { - return new MongoClusterImpl(inner, this.manager()); + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); } else { return null; } } - public void deleteByResourceGroup(String resourceGroupName, String mongoClusterName) { - this.serviceClient().delete(resourceGroupName, mongoClusterName); + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MongoClusterImpl(inner1, this.manager())); } - public void delete(String resourceGroupName, String mongoClusterName, Context context) { - this.serviceClient().delete(resourceGroupName, mongoClusterName, context); + 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) { @@ -71,14 +74,33 @@ public PagedIterable listByResourceGroup(String resourceGroupName, return ResourceManagerUtils.mapPage(inner, inner1 -> new MongoClusterImpl(inner1, this.manager())); } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - 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 PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new MongoClusterImpl(inner1, this.manager())); + 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, @@ -103,25 +125,13 @@ public ListConnectionStringsResult listConnectionStrings(String resourceGroupNam } } - 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 void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body) { + this.serviceClient().promote(resourceGroupName, mongoClusterName, body); } - 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 void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, + Context context) { + this.serviceClient().promote(resourceGroupName, mongoClusterName, body, context); } public MongoCluster getById(String id) { diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationImpl.java index cd003b9ad1baa..a3e07c629b0ca 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsClientImpl.java index ddcad08ab734f..402409d7ddd74 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsClientImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.mongocluster.fluent.OperationsClient; import com.azure.resourcemanager.mongocluster.fluent.models.OperationInner; -import com.azure.resourcemanager.mongocluster.implementation.models.OperationListResult; +import com.azure.resourcemanager.mongocluster.models.OperationListResult; import reactor.core.publisher.Mono; /** @@ -42,39 +42,39 @@ public final class OperationsClientImpl implements OperationsClient { /** * The service client containing this operation class. */ - private final DocumentDBClientImpl client; + private final MongoClusterManagementClientImpl client; /** * Initializes an instance of OperationsClientImpl. * * @param client the instance of the service client containing this operation class. */ - OperationsClientImpl(DocumentDBClientImpl client) { + OperationsClientImpl(MongoClusterManagementClientImpl client) { this.service = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for DocumentDBClientOperations to be used by the proxy service to perform - * REST calls. + * The interface defining all the services for MongoClusterManagementClientOperations to be used by the proxy + * service to perform REST calls. */ - @Host("{endpoint}") - @ServiceInterface(name = "DocumentDBClientOper") + @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("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept, Context context); + 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("endpoint") String endpoint, @HeaderParam("accept") String accept, Context context); + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsImpl.java index 341c50b16fc54..f6848113d939a 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/OperationsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionResourceImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionResourceImpl.java index 2c6c557d6f733..29cde3a8bd44b 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionResourceImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionResourceImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsClientImpl.java index 277e962a7b368..f3eacbeb05246 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsClientImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -33,7 +33,7 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.mongocluster.fluent.PrivateEndpointConnectionsClient; import com.azure.resourcemanager.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner; -import com.azure.resourcemanager.mongocluster.implementation.models.PrivateEndpointConnectionResourceListResult; +import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionResourceListResult; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -50,78 +50,78 @@ public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpoi /** * The service client containing this operation class. */ - private final DocumentDBClientImpl client; + private final MongoClusterManagementClientImpl client; /** * Initializes an instance of PrivateEndpointConnectionsClientImpl. * * @param client the instance of the service client containing this operation class. */ - PrivateEndpointConnectionsClientImpl(DocumentDBClientImpl client) { + PrivateEndpointConnectionsClientImpl(MongoClusterManagementClientImpl client) { this.service = RestProxy.create(PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for DocumentDBClientPrivateEndpointConnections to be used by the proxy - * service to perform REST calls. + * The interface defining all the services for MongoClusterManagementClientPrivateEndpointConnections to be used by + * the proxy service to perform REST calls. */ - @Host("{endpoint}") - @ServiceInterface(name = "DocumentDBClientPriv") + @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("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @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, + @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("endpoint") String endpoint, + 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); + @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("endpoint") String endpoint, + 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, - @HeaderParam("accept") String accept, - @BodyParam("application/json") PrivateEndpointConnectionResourceInner resource, Context context); + @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("endpoint") String endpoint, + 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); + @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("endpoint") String endpoint, - @HeaderParam("accept") String accept, Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -429,7 +429,8 @@ public PrivateEndpointConnectionResourceInner get(String resourceGroupName, Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + * @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, @@ -463,7 +464,7 @@ private Mono>> createWithResponseAsync(String resource return FluxUtil .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, privateEndpointConnectionName, - accept, resource, context)) + resource, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -479,7 +480,8 @@ private Mono>> createWithResponseAsync(String 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 response body along with {@link Response} on successful completion of {@link Mono}. + * @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, @@ -512,7 +514,7 @@ private Mono>> createWithResponseAsync(String resource 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, accept, resource, context); + resourceGroupName, mongoClusterName, privateEndpointConnectionName, resource, accept, context); } /** @@ -526,7 +528,8 @@ private Mono>> createWithResponseAsync(String 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. + * @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> @@ -551,7 +554,8 @@ private Mono>> createWithResponseAsync(String 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. + * @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> @@ -576,7 +580,8 @@ private Mono>> createWithResponseAsync(String 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. + * @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> @@ -598,7 +603,8 @@ private Mono>> createWithResponseAsync(String 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. + * @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> @@ -620,7 +626,8 @@ private Mono>> createWithResponseAsync(String 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 response body on successful completion of {@link Mono}. + * @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, @@ -641,7 +648,8 @@ private Mono createAsync(String 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 response body on successful completion of {@link Mono}. + * @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, @@ -662,7 +670,7 @@ private Mono createAsync(String 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 response. + * @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, @@ -682,7 +690,7 @@ public PrivateEndpointConnectionResourceInner create(String resourceGroupName, S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @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, diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsImpl.java index 8d1204e21c235..b9d74f1fd67b2 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateEndpointConnectionsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinkResourceImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinkResourceImpl.java index f39e35cbbc0f6..94294069d048d 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinkResourceImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinkResourceImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksClientImpl.java index 26b63a75d40cf..9aa0b12026423 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksClientImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.mongocluster.fluent.PrivateLinksClient; import com.azure.resourcemanager.mongocluster.fluent.models.PrivateLinkResourceInner; -import com.azure.resourcemanager.mongocluster.implementation.models.PrivateLinkResourceListResult; +import com.azure.resourcemanager.mongocluster.models.PrivateLinkResourceListResult; import reactor.core.publisher.Mono; /** @@ -42,34 +42,34 @@ public final class PrivateLinksClientImpl implements PrivateLinksClient { /** * The service client containing this operation class. */ - private final DocumentDBClientImpl client; + private final MongoClusterManagementClientImpl client; /** * Initializes an instance of PrivateLinksClientImpl. * * @param client the instance of the service client containing this operation class. */ - PrivateLinksClientImpl(DocumentDBClientImpl client) { + PrivateLinksClientImpl(MongoClusterManagementClientImpl client) { this.service = RestProxy.create(PrivateLinksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for DocumentDBClientPrivateLinks to be used by the proxy service to - * perform REST calls. + * The interface defining all the services for MongoClusterManagementClientPrivateLinks to be used by the proxy + * service to perform REST calls. */ - @Host("{endpoint}") - @ServiceInterface(name = "DocumentDBClientPriv") + @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("endpoint") String endpoint, + 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, + @PathParam("mongoClusterName") String mongoClusterName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -77,8 +77,8 @@ Mono> listByMongoCluster(@HostParam("end @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByMongoClusterNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksImpl.java index 134ba73d361ed..4077660d608ef 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksImpl.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/PrivateLinksImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ReplicaImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ReplicaImpl.java new file mode 100644 index 0000000000000..675be58f695fa --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ReplicaImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mongocluster.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongocluster.fluent.models.ReplicaInner; +import com.azure.resourcemanager.mongocluster.models.MongoClusterProperties; +import com.azure.resourcemanager.mongocluster.models.Replica; + +public final class ReplicaImpl implements Replica { + private ReplicaInner innerObject; + + private final com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager; + + ReplicaImpl(ReplicaInner innerObject, com.azure.resourcemanager.mongocluster.MongoClusterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public MongoClusterProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ReplicaInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ReplicasClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ReplicasClientImpl.java new file mode 100644 index 0000000000000..dbb3762099ec3 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.mongocluster.fluent.ReplicasClient; +import com.azure.resourcemanager.mongocluster.fluent.models.ReplicaInner; +import com.azure.resourcemanager.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ReplicasImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ReplicasImpl.java new file mode 100644 index 0000000000000..f78d3353e2be7 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mongocluster.fluent.ReplicasClient; +import com.azure.resourcemanager.mongocluster.fluent.models.ReplicaInner; +import com.azure.resourcemanager.mongocluster.models.Replica; +import com.azure.resourcemanager.mongocluster.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.mongocluster.MongoClusterManager serviceManager; + + public ReplicasImpl(ReplicasClient innerClient, + com.azure.resourcemanager.mongocluster.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.mongocluster.MongoClusterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ResourceManagerUtils.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ResourceManagerUtils.java index feb7fa3ca2f57..e8dde58e8c4ec 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ResourceManagerUtils.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ResourceManagerUtils.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.implementation; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/package-info.java index 6ca3f50abfa5a..fbcee02138dd0 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/package-info.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/package-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. /** * Package containing the implementations for MongoClusterManagementClient. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ActionType.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ActionType.java index 6d0d60c2fe2fa..15bbf5e700cf7 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ActionType.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ActionType.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -8,7 +8,7 @@ import java.util.Collection; /** - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ public final class ActionType extends ExpandableStringEnum { /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityReason.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityReason.java index 335d5ebff5014..af5f5059f0200 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityReason.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityReason.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -8,7 +8,7 @@ import java.util.Collection; /** - * Possible reasons for a name not being available. + * The reason why the given name is not available. */ public final class CheckNameAvailabilityReason extends ExpandableStringEnum { /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityRequest.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityRequest.java index 9c0cbb077019e..ca8ff1f55221f 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityRequest.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityRequest.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityResponse.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityResponse.java index 3e22a3fb66040..eab187dd161d5 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityResponse.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CheckNameAvailabilityResponse.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -25,7 +25,7 @@ public interface CheckNameAvailabilityResponse { CheckNameAvailabilityReason reason(); /** - * Gets the message property: Detailed reason why the given name is not available. + * Gets the message property: Detailed reason why the given name is available. * * @return the message value. */ diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java index 14fc3246b8e8f..d5ccda21cafe9 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -29,7 +29,7 @@ public final class ConnectionString implements JsonSerializable { */ 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. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRule.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRule.java index 3a114c17e38ac..93341a278af36 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRule.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRule.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/FirewallRuleListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleListResult.java similarity index 80% rename from sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/FirewallRuleListResult.java rename to sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleListResult.java index c0a2bfc574b2f..ee2cd58ab7cb5 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/FirewallRuleListResult.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.mongocluster.implementation.models; +package com.azure.resourcemanager.mongocluster.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,7 +17,7 @@ /** * The response of a FirewallRule list operation. */ -@Immutable +@Fluent public final class FirewallRuleListResult implements JsonSerializable { /* * The FirewallRule items on this page @@ -32,7 +32,7 @@ public final class FirewallRuleListResult implements JsonSerializable 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. * @@ -53,6 +64,17 @@ 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. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleProperties.java index 854801a6c5f6e..fc4175f817bd3 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleProperties.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRuleProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRules.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRules.java index c4cae9325e469..57b91da7b1cff 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRules.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/FirewallRules.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -13,82 +13,82 @@ */ public interface FirewallRules { /** - * Gets information about a mongo cluster firewall rule. + * 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 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}. + * @return the response of a FirewallRule list operation as paginated response with {@link PagedIterable}. */ - Response getWithResponse(String resourceGroupName, String mongoClusterName, String firewallRuleName, - Context context); + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName); /** - * Gets information about a mongo cluster firewall rule. + * 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 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. + * @return the response of a FirewallRule list operation as paginated response with {@link PagedIterable}. */ - FirewallRule get(String resourceGroupName, String mongoClusterName, String firewallRuleName); + PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, Context context); /** - * Deletes a mongo cluster firewall rule. + * 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}. */ - void delete(String resourceGroupName, String mongoClusterName, String firewallRuleName); + Response getWithResponse(String resourceGroupName, String mongoClusterName, String firewallRuleName, + Context context); /** - * Deletes a mongo cluster firewall rule. + * 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. */ - void delete(String resourceGroupName, String mongoClusterName, String firewallRuleName, Context context); + FirewallRule get(String resourceGroupName, String mongoClusterName, String firewallRuleName); /** - * List all the firewall rules in a given mongo cluster. + * 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 response of a FirewallRule list operation as paginated response with {@link PagedIterable}. */ - PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName); + void delete(String resourceGroupName, String mongoClusterName, String firewallRuleName); /** - * List all the firewall rules in a given mongo cluster. + * 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 response of a FirewallRule list operation as paginated response with {@link PagedIterable}. */ - PagedIterable listByMongoCluster(String resourceGroupName, String mongoClusterName, Context context); + void delete(String resourceGroupName, String mongoClusterName, String firewallRuleName, Context context); /** * Gets information about a mongo cluster firewall rule. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ListConnectionStringsResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ListConnectionStringsResult.java index eedc1f35e213b..49e96a9a3630f 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ListConnectionStringsResult.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ListConnectionStringsResult.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoCluster.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoCluster.java index 87acbfa6f7bb9..b9da1373de436 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoCluster.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoCluster.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -285,4 +285,25 @@ interface WithProperties { * @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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/MongoClusterListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterListResult.java similarity index 80% rename from sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/MongoClusterListResult.java rename to sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterListResult.java index 50e1e35cd1e2c..3d74e15056c5c 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/MongoClusterListResult.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.mongocluster.implementation.models; +package com.azure.resourcemanager.mongocluster.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,7 +17,7 @@ /** * The response of a MongoCluster list operation. */ -@Immutable +@Fluent public final class MongoClusterListResult implements JsonSerializable { /* * The MongoCluster items on this page @@ -32,7 +32,7 @@ public final class MongoClusterListResult implements JsonSerializable 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. * @@ -53,6 +64,17 @@ 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. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterProperties.java index 2076c9f61d368..1feae89de452a 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterProperties.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -27,6 +27,11 @@ public final class MongoClusterProperties implements JsonSerializable 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. */ @@ -123,6 +143,26 @@ public MongoClusterProperties withRestoreParameters(MongoClusterRestoreParameter 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. * @@ -270,6 +310,44 @@ 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. * @@ -279,12 +357,18 @@ 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(); + } } /** @@ -295,6 +379,7 @@ 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); @@ -302,6 +387,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { 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(); } @@ -325,6 +412,9 @@ public static MongoClusterProperties fromJson(JsonReader jsonReader) throws IOEx } 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)) { @@ -351,6 +441,14 @@ public static MongoClusterProperties fromJson(JsonReader jsonReader) throws IOEx 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(); } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterReplicaParameters.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterReplicaParameters.java new file mode 100644 index 0000000000000..e098d26dee0a0 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterRestoreParameters.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterRestoreParameters.java index 57c5c55f6f731..7582212c14f3f 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterRestoreParameters.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterRestoreParameters.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -22,7 +22,7 @@ public final class MongoClusterRestoreParameters implements JsonSerializable CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("sourceResourceId".equals(fieldName)) { deserializedMongoClusterRestoreParameters.sourceResourceId = reader.getString(); diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java index b469f54827b3b..5e113dd8496dc 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdate.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdate.java index ab3980cd616ad..3a42dc4235bad 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdate.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdate.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdateProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdateProperties.java index 8b91a47f98d8d..09798e9bbd866 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdateProperties.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdateProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -42,6 +42,11 @@ public final class MongoClusterUpdateProperties implements JsonSerializable nodeGroupSpecs; + /* + * List of private endpoint connections. + */ + private List previewFeatures; + /** * Creates an instance of MongoClusterUpdateProperties class. */ @@ -150,6 +155,26 @@ public MongoClusterUpdateProperties withNodeGroupSpecs(List nodeG 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. * @@ -174,6 +199,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { 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(); } @@ -204,6 +231,10 @@ public static MongoClusterUpdateProperties fromJson(JsonReader jsonReader) throw } 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(); } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusters.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusters.java index 0e9c13f36d5a1..62bd5acc65a67 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusters.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusters.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -13,53 +13,50 @@ */ public interface MongoClusters { /** - * Gets information about a mongo cluster. + * Check if mongo cluster name is available for use. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. + * @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 information about a mongo cluster along with {@link Response}. + * @return the check availability result along with {@link Response}. */ - Response getByResourceGroupWithResponse(String resourceGroupName, String mongoClusterName, - Context context); + Response checkNameAvailabilityWithResponse(String location, + CheckNameAvailabilityRequest body, Context context); /** - * Gets information about a mongo cluster. + * Check if mongo cluster name is available for use. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param mongoClusterName The name of the mongo cluster. + * @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 information about a mongo cluster. + * @return the check availability result. */ - MongoCluster getByResourceGroup(String resourceGroupName, String mongoClusterName); + CheckNameAvailabilityResponse checkNameAvailability(String location, CheckNameAvailabilityRequest body); /** - * Deletes a mongo cluster. + * List all the mongo clusters in a given subscription. * - * @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 MongoCluster list operation as paginated response with {@link PagedIterable}. */ - void deleteByResourceGroup(String resourceGroupName, String mongoClusterName); + PagedIterable list(); /** - * Deletes a mongo cluster. + * List all the mongo clusters in a given subscription. * - * @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 MongoCluster list operation as paginated response with {@link PagedIterable}. */ - void delete(String resourceGroupName, String mongoClusterName, Context context); + PagedIterable list(Context context); /** * List all the mongo clusters in a given resource group. @@ -85,24 +82,53 @@ Response getByResourceGroupWithResponse(String resourceGroupName, PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * List all the mongo clusters in a given subscription. + * 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 the response of a MongoCluster list operation as paginated response with {@link PagedIterable}. + * @return information about a mongo cluster along with {@link Response}. */ - PagedIterable list(); + Response getByResourceGroupWithResponse(String resourceGroupName, String mongoClusterName, + Context context); /** - * List all the mongo clusters in a given subscription. + * 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. - * @return the response of a MongoCluster list operation as paginated response with {@link PagedIterable}. */ - PagedIterable list(Context context); + 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 @@ -133,30 +159,29 @@ Response listConnectionStringsWithResponse(String r ListConnectionStringsResult listConnectionStrings(String resourceGroupName, String mongoClusterName); /** - * Check if mongo cluster name is available for use. + * Promotes a replica mongo cluster to a primary role. * - * @param location The location name. - * @param body The CheckAvailability request. - * @param context The context to associate with this operation. + * @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 check availability result along with {@link Response}. */ - Response checkNameAvailabilityWithResponse(String location, - CheckNameAvailabilityRequest body, Context context); + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body); /** - * Check if mongo cluster name is available for use. + * Promotes a replica mongo cluster to a primary role. * - * @param location The location name. - * @param body The CheckAvailability request. + * @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 check availability result. */ - CheckNameAvailabilityResponse checkNameAvailability(String location, CheckNameAvailabilityRequest body); + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, Context context); /** * Gets information about a mongo cluster. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java index 0d8be2cd17c9a..f597b9b4d7069 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java index 5636767e526a3..ef4fefb4542c2 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operation.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operation.java index a06d1ab966819..cd684886d7506 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operation.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operation.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -20,7 +20,7 @@ public interface Operation { /** * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane - * operations and "false" for Azure Resource Manager/control-plane operations. + * operations and "false" for ARM/control-plane operations. * * @return the isDataAction value. */ @@ -42,8 +42,8 @@ public interface Operation { Origin origin(); /** - * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are - * for internal only APIs. + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. * * @return the actionType value. */ diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationDisplay.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationDisplay.java index 18e364e58728b..4b422c0110a25 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationDisplay.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/OperationDisplay.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -12,7 +12,7 @@ import java.io.IOException; /** - * Localized display information for and operation. + * Localized display information for this particular operation. */ @Immutable public final class OperationDisplay implements JsonSerializable { @@ -42,7 +42,7 @@ public final class OperationDisplay implements JsonSerializable { /* - * The Operation items on this page + * List of operations supported by the resource provider */ private List value; /* - * The link to the next page of items + * URL to get the next set of operation list results (if there are any). */ private String nextLink; /** * Creates an instance of OperationListResult class. */ - private OperationListResult() { + public OperationListResult() { } /** - * Get the value property: The Operation items on this page. + * Get the value property: List of operations supported by the resource provider. * * @return the value value. */ @@ -46,7 +45,7 @@ public List value() { } /** - * Get the nextLink property: The link to the next page of items. + * Get the nextLink property: URL to get the next set of operation list results (if there are any). * * @return the nextLink value. */ @@ -60,24 +59,17 @@ public String nextLink() { * @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 OperationListResult")); - } else { + if (value() != null) { value().forEach(e -> e.validate()); } } - private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.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(); } @@ -87,7 +79,6 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @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 IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the OperationListResult. */ public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operations.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operations.java index b8c6cd9e72c80..1b5aacdf9a3b4 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operations.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Operations.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Origin.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Origin.java index 59bf2c1cd60d4..41565f5e3c424 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Origin.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Origin.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PreviewFeature.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PreviewFeature.java new file mode 100644 index 0000000000000..6b8d7737df7ff --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpoint.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpoint.java index 479e1b85b1d3e..035cc8d4dc572 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpoint.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpoint.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; @@ -12,12 +12,12 @@ import java.io.IOException; /** - * The Private Endpoint resource. + * The private endpoint resource. */ @Immutable public final class PrivateEndpoint implements JsonSerializable { /* - * The resource identifier for private endpoint + * The ARM identifier for private endpoint. */ private String id; @@ -28,7 +28,7 @@ public PrivateEndpoint() { } /** - * Get the id property: The resource identifier for private endpoint. + * Get the id property: The ARM identifier for private endpoint. * * @return the id value. */ diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnection.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnection.java index 7738c146f8a89..ac53fd1c8b3ba 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnection.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnection.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.json.JsonReader; @@ -15,10 +15,10 @@ /** * The private endpoint connection resource. */ -@Immutable +@Fluent public final class PrivateEndpointConnection extends ProxyResource { /* - * The private endpoint connection properties + * Resource properties. */ private PrivateEndpointConnectionProperties properties; @@ -45,11 +45,11 @@ public final class PrivateEndpointConnection extends ProxyResource { /** * Creates an instance of PrivateEndpointConnection class. */ - private PrivateEndpointConnection() { + public PrivateEndpointConnection() { } /** - * Get the properties property: The private endpoint connection properties. + * Get the properties property: Resource properties. * * @return the properties value. */ @@ -57,6 +57,17 @@ 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. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProperties.java index 68e9bea3d0cf6..fc1bf1c2d34c0 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProperties.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProvisioningState.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProvisioningState.java index 0a22c9c37624a..2d32dd7a52739 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProvisioningState.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionProvisioningState.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResource.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResource.java index 359dbcfe92814..5660e9539ae3d 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResource.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResource.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/PrivateEndpointConnectionResourceListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResourceListResult.java similarity index 80% rename from sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/PrivateEndpointConnectionResourceListResult.java rename to sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResourceListResult.java index 9348d84fdab68..e8d003793ccd1 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/PrivateEndpointConnectionResourceListResult.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnectionResourceListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.mongocluster.implementation.models; +package com.azure.resourcemanager.mongocluster.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,7 +17,7 @@ /** * The response of a PrivateEndpointConnectionResource list operation. */ -@Immutable +@Fluent public final class PrivateEndpointConnectionResourceListResult implements JsonSerializable { /* @@ -33,7 +33,7 @@ public final class PrivateEndpointConnectionResourceListResult /** * Creates an instance of PrivateEndpointConnectionResourceListResult class. */ - private PrivateEndpointConnectionResourceListResult() { + public PrivateEndpointConnectionResourceListResult() { } /** @@ -45,6 +45,17 @@ 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. * @@ -54,6 +65,17 @@ 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. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnections.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnections.java index db4cbfe4d49af..25fd6289efa45 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnections.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointConnections.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointServiceConnectionStatus.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointServiceConnectionStatus.java index 22b2f34d78d42..efda8550a43db 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointServiceConnectionStatus.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateEndpointServiceConnectionStatus.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResource.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResource.java index 0e45ce29422c1..bb021b934de0e 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResource.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResource.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/PrivateLinkResourceListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceListResult.java similarity index 80% rename from sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/PrivateLinkResourceListResult.java rename to sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceListResult.java index 2d6fcc20b7917..df74c433b29ba 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/PrivateLinkResourceListResult.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.mongocluster.implementation.models; +package com.azure.resourcemanager.mongocluster.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,7 +17,7 @@ /** * The response of a PrivateLinkResource list operation. */ -@Immutable +@Fluent public final class PrivateLinkResourceListResult implements JsonSerializable { /* * The PrivateLinkResource items on this page @@ -32,7 +32,7 @@ public final class PrivateLinkResourceListResult implements JsonSerializable 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. * @@ -53,6 +64,17 @@ 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. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceProperties.java index c9043171959d9..122c25ea7b92a 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceProperties.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkResourceProperties.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -15,7 +15,7 @@ /** * Properties of a private link resource. */ -@Immutable +@Fluent public final class PrivateLinkResourceProperties implements JsonSerializable { /* * The private link resource group id. @@ -35,7 +35,7 @@ public final class PrivateLinkResourceProperties implements JsonSerializable 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. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkServiceConnectionState.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkServiceConnectionState.java index 5c8f98c9b4c58..5fd4f90880b0d 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkServiceConnectionState.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinkServiceConnectionState.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinks.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinks.java index 7538a6b9c88ff..58187b36b128a 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinks.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PrivateLinks.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PromoteMode.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PromoteMode.java new file mode 100644 index 0000000000000..08917611cbd76 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PromoteOption.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PromoteOption.java new file mode 100644 index 0000000000000..d06d9f368ec9f --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PromoteReplicaRequest.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PromoteReplicaRequest.java new file mode 100644 index 0000000000000..8a4ad4e2d2e71 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ProvisioningState.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ProvisioningState.java index cb2e1303a3d9c..352d1532eb508 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ProvisioningState.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ProvisioningState.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PublicNetworkAccess.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PublicNetworkAccess.java index a6c496d338081..94ae84e360088 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PublicNetworkAccess.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PublicNetworkAccess.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.models; diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Replica.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Replica.java new file mode 100644 index 0000000000000..8ab88d907bc2f --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.mongocluster.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.mongocluster.fluent.models.ReplicaInner object. + * + * @return the inner object. + */ + ReplicaInner innerModel(); +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ReplicaListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ReplicaListResult.java new file mode 100644 index 0000000000000..d57bb486b6b28 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Replicas.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Replicas.java new file mode 100644 index 0000000000000..e5c4a920d369b --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ReplicationProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ReplicationProperties.java new file mode 100644 index 0000000000000..25878827b84a0 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ReplicationRole.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ReplicationRole.java new file mode 100644 index 0000000000000..612cc659fb3df --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ReplicationState.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ReplicationState.java new file mode 100644 index 0000000000000..b0892b383b1df --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/package-info.java index 3fc1a19403983..2ad79ee81561e 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/package-info.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/package-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. /** * Package containing the data models for MongoClusterManagementClient. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/package-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/package-info.java index 2abe0e217c6cc..b597e092072d9 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/package-info.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/package-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. /** * Package containing the classes for MongoClusterManagementClient. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/module-info.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/module-info.java index 0ad695f88da05..37dd439c860c8 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/module-info.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/module-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. module com.azure.resourcemanager.mongocluster { requires transitive com.azure.core.management; @@ -10,5 +10,4 @@ exports com.azure.resourcemanager.mongocluster.models; opens com.azure.resourcemanager.mongocluster.fluent.models to com.azure.core; opens com.azure.resourcemanager.mongocluster.models to com.azure.core; - opens com.azure.resourcemanager.mongocluster.implementation.models to com.azure.core; } \ No newline at end of file diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/proxy-config.json b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/proxy-config.json index eef96343f9f9e..325d8725d9549 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/proxy-config.json +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mongocluster/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.mongocluster.implementation.FirewallRulesClientImpl$FirewallRulesService"],["com.azure.resourcemanager.mongocluster.implementation.MongoClustersClientImpl$MongoClustersService"],["com.azure.resourcemanager.mongocluster.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.mongocluster.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService"],["com.azure.resourcemanager.mongocluster.implementation.PrivateLinksClientImpl$PrivateLinksService"]] \ No newline at end of file +[["com.azure.resourcemanager.mongocluster.implementation.FirewallRulesClientImpl$FirewallRulesService"],["com.azure.resourcemanager.mongocluster.implementation.MongoClustersClientImpl$MongoClustersService"],["com.azure.resourcemanager.mongocluster.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.mongocluster.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService"],["com.azure.resourcemanager.mongocluster.implementation.PrivateLinksClientImpl$PrivateLinksService"],["com.azure.resourcemanager.mongocluster.implementation.ReplicasClientImpl$ReplicasService"]] \ No newline at end of file diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateSamples.java index 5022e06595121..a2027762acf3c 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -11,7 +11,8 @@ */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_FirewallRuleCreate.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesDeleteSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesDeleteSamples.java index 1f9fcc9eff510..4bd013f3cb268 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesDeleteSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesDeleteSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -9,7 +9,8 @@ */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_FirewallRuleDelete.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetSamples.java index ae5b03f893e1d..11096106568a3 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -9,7 +9,8 @@ */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_FirewallRuleGet.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterSamples.java index ca9648b8c3c82..3dd6c9a9b68fd 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -9,7 +9,8 @@ */ public final class FirewallRulesListByMongoClusterSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_FirewallRuleList.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilitySamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilitySamples.java index 5a7c6932fdcf1..5168e5ca65ec7 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilitySamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilitySamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -11,7 +11,8 @@ */ public final class MongoClustersCheckNameAvailabilitySamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_NameAvailability.json */ /** @@ -27,7 +28,8 @@ public static void checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse( } /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_NameAvailability_AlreadyExists.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCreateOrUpdateSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCreateOrUpdateSamples.java index 6f41cfc4dd815..a802c3b4ca9d5 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCreateOrUpdateSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCreateOrUpdateSamples.java @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; import com.azure.resourcemanager.mongocluster.models.CreateMode; import com.azure.resourcemanager.mongocluster.models.MongoClusterProperties; +import com.azure.resourcemanager.mongocluster.models.MongoClusterReplicaParameters; import com.azure.resourcemanager.mongocluster.models.MongoClusterRestoreParameters; import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; import com.azure.resourcemanager.mongocluster.models.NodeKind; @@ -17,7 +18,31 @@ */ public final class MongoClustersCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/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.mongocluster.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/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_CreatePITR.json */ /** @@ -33,7 +58,7 @@ public static void createsAMongoClusterResourceFromAPointInTimeRestore( .withExistingResourceGroup("TestResourceGroup") .withProperties(new MongoClusterProperties().withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) .withRestoreParameters(new MongoClusterRestoreParameters() - .withPointInTimeUTC(OffsetDateTime.parse("2023-01-13T20:07:35Z")) + .withPointInTimeUtc(OffsetDateTime.parse("2023-01-13T20:07:35Z")) .withSourceResourceId( "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster"))) .create(); @@ -41,8 +66,8 @@ public static void createsAMongoClusterResourceFromAPointInTimeRestore( /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Create. - * json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_Create.json */ /** * Sample code: Creates a new Mongo Cluster resource. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.java index 9d23c6f80638f..3af27640fa6fd 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -10,8 +10,8 @@ public final class MongoClustersDeleteSamples { /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Delete. - * json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_Delete.json */ /** * Sample code: Deletes a Mongo Cluster resource. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersGetByResourceGroupSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersGetByResourceGroupSamples.java index 1e10c628f4b1d..a94d3588dde50 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersGetByResourceGroupSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersGetByResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -10,7 +10,8 @@ public final class MongoClustersGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Get.json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_Get.json */ /** * Sample code: Gets a Mongo Cluster resource. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListByResourceGroupSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListByResourceGroupSamples.java index edd7b1e476e4b..62957fa2c63de 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListByResourceGroupSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListByResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -9,7 +9,8 @@ */ public final class MongoClustersListByResourceGroupSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_ListByResourceGroup.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsSamples.java index 1274f8753a2be..aac0ca9984302 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -9,7 +9,8 @@ */ public final class MongoClustersListConnectionStringsSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_ListConnectionStrings.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListSamples.java index e20ca6a453284..1ca231ce38658 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -10,7 +10,8 @@ public final class MongoClustersListSamples { /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_List.json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_List.json */ /** * Sample code: Lists the Mongo Cluster resources in a subscription. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersPromoteSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersPromoteSamples.java new file mode 100644 index 0000000000000..8e092b9f38dd5 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/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.mongocluster.generated; + +import com.azure.resourcemanager.mongocluster.models.PromoteMode; +import com.azure.resourcemanager.mongocluster.models.PromoteOption; +import com.azure.resourcemanager.mongocluster.models.PromoteReplicaRequest; + +/** + * Samples for MongoClusters Promote. + */ +public final class MongoClustersPromoteSamples { + /* + * x-ms-original-file: + * specification/mongocluster/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.mongocluster.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/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersUpdateSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersUpdateSamples.java index d56b98c0fdfaa..c0f9399ece6d4 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersUpdateSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersUpdateSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -16,7 +16,29 @@ */ public final class MongoClustersUpdateSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/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.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties().withAdministratorLogin("mongoAdmin") + .withAdministratorLoginPassword("fakeTokenPlaceholder")) + .apply(); + } + + /* + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PatchDiskSize.json */ /** @@ -36,7 +58,8 @@ public final class MongoClustersUpdateSamples { } /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PatchPrivateNetworkAccess.json */ /** @@ -56,8 +79,8 @@ public static void disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivat /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Update. - * json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * MongoClusters_Update.json */ /** * Sample code: Updates a Mongo Cluster resource. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java index d9abaa3765c4e..fa421e71e90d7 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -10,7 +10,8 @@ public final class OperationsListSamples { /* * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/Operations_List.json + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ + * Operations_List.json */ /** * Sample code: Operations_List. diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateSamples.java index 3906e8d37aa25..6be059d70699a 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -13,7 +13,8 @@ */ public final class PrivateEndpointConnectionsCreateSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateEndpointConnectionPut.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsDeleteSamples.java index c909e9de721aa..3cabaf5fabaeb 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsDeleteSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -9,7 +9,8 @@ */ public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateEndpointConnectionDelete.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetSamples.java index b2bfa1dfd1bb7..ec0c32b54db93 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -9,7 +9,8 @@ */ public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateEndpointConnectionGet.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java index 03a45aafc5967..7b2451e4106a4 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -9,7 +9,8 @@ */ public final class PrivateEndpointConnectionsListByMongoClusterSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateEndpointConnectionList.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterSamples.java index 9e62436ca8174..c4f87e46e867c 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterSamples.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mongocluster.generated; @@ -9,7 +9,8 @@ */ public final class PrivateLinksListByMongoClusterSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ + * x-ms-original-file: + * specification/mongocluster/resource-manager/Microsoft.DocumentDB/preview/2024-06-01-preview/examples/ * MongoClusters_PrivateLinkResourceList.json */ /** diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/ReplicasListByParentSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/ReplicasListByParentSamples.java new file mode 100644 index 0000000000000..b1141e40e2299 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/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.mongocluster.generated; + +/** + * Samples for Replicas ListByParent. + */ +public final class ReplicasListByParentSamples { + /* + * x-ms-original-file: + * specification/mongocluster/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.mongocluster.MongoClusterManager manager) { + manager.replicas().listByParent("TestGroup", "myMongoCluster", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/CheckNameAvailabilityRequestTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/CheckNameAvailabilityRequestTests.java deleted file mode 100644 index b461bea044fa0..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/CheckNameAvailabilityRequestTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; -import org.junit.jupiter.api.Assertions; - -public final class CheckNameAvailabilityRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckNameAvailabilityRequest model = BinaryData.fromString("{\"name\":\"jaeq\",\"type\":\"qjbasvms\"}") - .toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("jaeq", model.name()); - Assertions.assertEquals("qjbasvms", model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckNameAvailabilityRequest model = new CheckNameAvailabilityRequest().withName("jaeq").withType("qjbasvms"); - model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("jaeq", model.name()); - Assertions.assertEquals("qjbasvms", model.type()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/CheckNameAvailabilityResponseInnerTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/CheckNameAvailabilityResponseInnerTests.java deleted file mode 100644 index ddf5b1007f094..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/CheckNameAvailabilityResponseInnerTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.fluent.models.CheckNameAvailabilityResponseInner; -import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityReason; -import org.junit.jupiter.api.Assertions; - -public final class CheckNameAvailabilityResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckNameAvailabilityResponseInner model = BinaryData - .fromString("{\"nameAvailable\":true,\"reason\":\"AlreadyExists\",\"message\":\"gsntnbybkzgcwr\"}") - .toObject(CheckNameAvailabilityResponseInner.class); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, model.reason()); - Assertions.assertEquals("gsntnbybkzgcwr", model.message()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ConnectionStringTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ConnectionStringTests.java deleted file mode 100644 index e5d1d04f498e1..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ConnectionStringTests.java +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.ConnectionString; - -public final class ConnectionStringTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConnectionString model - = BinaryData.fromString("{\"connectionString\":\"xgispemvtzfkufu\",\"description\":\"jofxqe\"}") - .toObject(ConnectionString.class); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRuleInnerTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRuleInnerTests.java deleted file mode 100644 index d6dcd9595e484..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRuleInnerTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.fluent.models.FirewallRuleInner; -import com.azure.resourcemanager.mongocluster.models.FirewallRuleProperties; -import org.junit.jupiter.api.Assertions; - -public final class FirewallRuleInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FirewallRuleInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Failed\",\"startIpAddress\":\"xwrljdouskcqvkoc\",\"endIpAddress\":\"cjdkwtnhxbnjbi\"},\"id\":\"qrglssainqpjwn\",\"name\":\"lljfmppeeb\",\"type\":\"mgxsab\"}") - .toObject(FirewallRuleInner.class); - Assertions.assertEquals("xwrljdouskcqvkoc", model.properties().startIpAddress()); - Assertions.assertEquals("cjdkwtnhxbnjbi", model.properties().endIpAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FirewallRuleInner model = new FirewallRuleInner().withProperties( - new FirewallRuleProperties().withStartIpAddress("xwrljdouskcqvkoc").withEndIpAddress("cjdkwtnhxbnjbi")); - model = BinaryData.fromObject(model).toObject(FirewallRuleInner.class); - Assertions.assertEquals("xwrljdouskcqvkoc", model.properties().startIpAddress()); - Assertions.assertEquals("cjdkwtnhxbnjbi", model.properties().endIpAddress()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRuleListResultTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRuleListResultTests.java deleted file mode 100644 index ace39d9f4a92d..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRuleListResultTests.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.implementation.models.FirewallRuleListResult; -import org.junit.jupiter.api.Assertions; - -public final class FirewallRuleListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FirewallRuleListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"InProgress\",\"startIpAddress\":\"evndh\",\"endIpAddress\":\"rwpdappdsbdkvwrw\"},\"id\":\"eusnhutj\",\"name\":\"ltmrldh\",\"type\":\"gjzzdatqxhocdg\"},{\"properties\":{\"provisioningState\":\"InProgress\",\"startIpAddress\":\"gphuticndvka\",\"endIpAddress\":\"zwyiftyhxhur\"},\"id\":\"ftyxolniw\",\"name\":\"wcukjfkgiawxk\",\"type\":\"ryplwckbasyypn\"}],\"nextLink\":\"hsgcbacphejkot\"}") - .toObject(FirewallRuleListResult.class); - Assertions.assertEquals("evndh", model.value().get(0).properties().startIpAddress()); - Assertions.assertEquals("rwpdappdsbdkvwrw", model.value().get(0).properties().endIpAddress()); - Assertions.assertEquals("hsgcbacphejkot", model.nextLink()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulePropertiesTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulePropertiesTests.java deleted file mode 100644 index 6c8333ec75b88..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulePropertiesTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.FirewallRuleProperties; -import org.junit.jupiter.api.Assertions; - -public final class FirewallRulePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FirewallRuleProperties model = BinaryData - .fromString("{\"provisioningState\":\"Canceled\",\"startIpAddress\":\"duuji\",\"endIpAddress\":\"c\"}") - .toObject(FirewallRuleProperties.class); - Assertions.assertEquals("duuji", model.startIpAddress()); - Assertions.assertEquals("c", model.endIpAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FirewallRuleProperties model = new FirewallRuleProperties().withStartIpAddress("duuji").withEndIpAddress("c"); - model = BinaryData.fromObject(model).toObject(FirewallRuleProperties.class); - Assertions.assertEquals("duuji", model.startIpAddress()); - Assertions.assertEquals("c", model.endIpAddress()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateMockTests.java deleted file mode 100644 index c0629c05e6eba..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesCreateOrUpdateMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.FirewallRule; -import com.azure.resourcemanager.mongocluster.models.FirewallRuleProperties; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class FirewallRulesCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"startIpAddress\":\"auu\",\"endIpAddress\":\"mjmvxieduugidyjr\"},\"id\":\"byao\",\"name\":\"v\",\"type\":\"xc\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - FirewallRule response = manager.firewallRules() - .define("yokacspkw") - .withExistingMongoCluster("watkpnpulexxb", "zwtruwiqzbqjvsov") - .withProperties(new FirewallRuleProperties().withStartIpAddress("obpxjmflbvvn").withEndIpAddress("hrk")) - .create(); - - Assertions.assertEquals("auu", response.properties().startIpAddress()); - Assertions.assertEquals("mjmvxieduugidyjr", response.properties().endIpAddress()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetWithResponseMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetWithResponseMockTests.java deleted file mode 100644 index b8b1c5dbabef4..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesGetWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.FirewallRule; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class FirewallRulesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"InProgress\",\"startIpAddress\":\"cma\",\"endIpAddress\":\"u\"},\"id\":\"thfuiuaodsfcpkvx\",\"name\":\"dpuozmyz\",\"type\":\"dagfuaxbezyiuok\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - FirewallRule response = manager.firewallRules() - .getWithResponse("zsqpjhvmdajvny", "ounqecano", "eupfhyhltrpm", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("cma", response.properties().startIpAddress()); - Assertions.assertEquals("u", response.properties().endIpAddress()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterMockTests.java deleted file mode 100644 index f7ca99bdc0a1a..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/FirewallRulesListByMongoClusterMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.FirewallRule; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class FirewallRulesListByMongoClusterMockTests { - @Test - public void testListByMongoCluster() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"startIpAddress\":\"yocf\",\"endIpAddress\":\"fksymddystki\"},\"id\":\"xhqyudxorrqnb\",\"name\":\"oczvy\",\"type\":\"fqrvkdvjsllrmvvd\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.firewallRules().listByMongoCluster("twhrdxwzywqsm", "surex", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("yocf", response.iterator().next().properties().startIpAddress()); - Assertions.assertEquals("fksymddystki", response.iterator().next().properties().endIpAddress()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ListConnectionStringsResultInnerTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ListConnectionStringsResultInnerTests.java deleted file mode 100644 index bdfaca04844b0..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ListConnectionStringsResultInnerTests.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.fluent.models.ListConnectionStringsResultInner; - -public final class ListConnectionStringsResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ListConnectionStringsResultInner model = BinaryData - .fromString( - "{\"connectionStrings\":[{\"connectionString\":\"vyevcciqi\",\"description\":\"hungbwjzrnf\"}]}") - .toObject(ListConnectionStringsResultInner.class); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClusterRestoreParametersTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClusterRestoreParametersTests.java deleted file mode 100644 index 0b1a57fc98dbc..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClusterRestoreParametersTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.MongoClusterRestoreParameters; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class MongoClusterRestoreParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MongoClusterRestoreParameters model - = BinaryData.fromString("{\"pointInTimeUTC\":\"2021-07-26T12:53:27Z\",\"sourceResourceId\":\"n\"}") - .toObject(MongoClusterRestoreParameters.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-26T12:53:27Z"), model.pointInTimeUTC()); - Assertions.assertEquals("n", model.sourceResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MongoClusterRestoreParameters model - = new MongoClusterRestoreParameters().withPointInTimeUTC(OffsetDateTime.parse("2021-07-26T12:53:27Z")) - .withSourceResourceId("n"); - model = BinaryData.fromObject(model).toObject(MongoClusterRestoreParameters.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-26T12:53:27Z"), model.pointInTimeUTC()); - Assertions.assertEquals("n", model.sourceResourceId()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilityWithResponseMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilityWithResponseMockTests.java deleted file mode 100644 index a83c527d5026b..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersCheckNameAvailabilityWithResponseMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityReason; -import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; -import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class MongoClustersCheckNameAvailabilityWithResponseMockTests { - @Test - public void testCheckNameAvailabilityWithResponse() throws Exception { - String responseStr = "{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"amdecte\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CheckNameAvailabilityResponse response = manager.mongoClusters() - .checkNameAvailabilityWithResponse("uofqwe", - new CheckNameAvailabilityRequest().withName("hmenevfyexfwhybc").withType("vyvdcs"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(false, response.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, response.reason()); - Assertions.assertEquals("amdecte", response.message()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsWithResponseMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsWithResponseMockTests.java deleted file mode 100644 index 5b4f0a84998f3..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersListConnectionStringsWithResponseMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.ListConnectionStringsResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class MongoClustersListConnectionStringsWithResponseMockTests { - @Test - public void testListConnectionStringsWithResponse() throws Exception { - String responseStr - = "{\"connectionStrings\":[{\"connectionString\":\"dnvowg\",\"description\":\"jugwdkcglhsl\"},{\"connectionString\":\"jdyggdtji\",\"description\":\"b\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ListConnectionStringsResult response = manager.mongoClusters() - .listConnectionStringsWithResponse("ppusuesnzwdejba", "orxzdmohctbqvud", com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/NodeGroupSpecTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/NodeGroupSpecTests.java deleted file mode 100644 index 8fe5cfa865f54..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/NodeGroupSpecTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; -import com.azure.resourcemanager.mongocluster.models.NodeKind; -import org.junit.jupiter.api.Assertions; - -public final class NodeGroupSpecTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NodeGroupSpec model = BinaryData.fromString( - "{\"sku\":\"b\",\"diskSizeGB\":7532718659837556043,\"enableHa\":false,\"kind\":\"Shard\",\"nodeCount\":920256064}") - .toObject(NodeGroupSpec.class); - Assertions.assertEquals("b", model.sku()); - Assertions.assertEquals(7532718659837556043L, model.diskSizeGB()); - Assertions.assertEquals(false, model.enableHa()); - Assertions.assertEquals(NodeKind.SHARD, model.kind()); - Assertions.assertEquals(920256064, model.nodeCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NodeGroupSpec model = new NodeGroupSpec().withSku("b") - .withDiskSizeGB(7532718659837556043L) - .withEnableHa(false) - .withKind(NodeKind.SHARD) - .withNodeCount(920256064); - model = BinaryData.fromObject(model).toObject(NodeGroupSpec.class); - Assertions.assertEquals("b", model.sku()); - Assertions.assertEquals(7532718659837556043L, model.diskSizeGB()); - Assertions.assertEquals(false, model.enableHa()); - Assertions.assertEquals(NodeKind.SHARD, model.kind()); - Assertions.assertEquals(920256064, model.nodeCount()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationDisplayTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationDisplayTests.java deleted file mode 100644 index 66c3545bedbe8..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationDisplayTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = BinaryData.fromString( - "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") - .toObject(OperationDisplay.class); - Assertions.assertEquals("cdm", model.provider()); - Assertions.assertEquals("rcryuanzwuxzdxta", model.resource()); - Assertions.assertEquals("lhmwhfpmrqobm", model.operation()); - Assertions.assertEquals("kknryrtihf", model.description()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationInnerTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationInnerTests.java deleted file mode 100644 index 0b1e004f27426..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationInnerTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.fluent.models.OperationInner; -import com.azure.resourcemanager.mongocluster.models.ActionType; -import org.junit.jupiter.api.Assertions; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = BinaryData.fromString( - "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") - .toObject(OperationInner.class); - Assertions.assertEquals("eqsrdeupewnwreit", model.display().provider()); - Assertions.assertEquals("yflusarhmofc", model.display().resource()); - Assertions.assertEquals("smy", model.display().operation()); - Assertions.assertEquals("kdtmlxhekuk", model.display().description()); - Assertions.assertEquals(ActionType.INTERNAL, model.actionType()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationListResultTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationListResultTests.java deleted file mode 100644 index 747d621981ea7..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.implementation.models.OperationListResult; -import com.azure.resourcemanager.mongocluster.models.ActionType; -import org.junit.jupiter.api.Assertions; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = BinaryData.fromString( - "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") - .toObject(OperationListResult.class); - Assertions.assertEquals("pybczmehmtzopb", model.value().get(0).display().provider()); - Assertions.assertEquals("h", model.value().get(0).display().resource()); - Assertions.assertEquals("pidgsybbejhphoyc", model.value().get(0).display().operation()); - Assertions.assertEquals("xaobhdxbmtqioqjz", model.value().get(0).display().description()); - Assertions.assertEquals(ActionType.INTERNAL, model.value().get(0).actionType()); - Assertions.assertEquals("kfo", model.nextLink()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationsListMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationsListMockTests.java deleted file mode 100644 index b4c870d5bbcb1..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationsListMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.ActionType; -import com.azure.resourcemanager.mongocluster.models.Operation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"name\":\"c\",\"isDataAction\":true,\"display\":{\"provider\":\"bacfionlebxetq\",\"resource\":\"zxdpnqbqqw\",\"operation\":\"jfeallnwsub\",\"description\":\"njampm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("bacfionlebxetq", response.iterator().next().display().provider()); - Assertions.assertEquals("zxdpnqbqqw", response.iterator().next().display().resource()); - Assertions.assertEquals("jfeallnwsub", response.iterator().next().display().operation()); - Assertions.assertEquals("njampm", response.iterator().next().display().description()); - Assertions.assertEquals(ActionType.INTERNAL, response.iterator().next().actionType()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionPropertiesTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionPropertiesTests.java deleted file mode 100644 index af1ff53fc0185..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionPropertiesTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpoint; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionProperties; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.mongocluster.models.PrivateLinkServiceConnectionState; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointConnectionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnectionProperties model = BinaryData.fromString( - "{\"groupIds\":[\"xj\",\"prozvcputegjvwmf\",\"atscmd\",\"pjhulsuuvmkj\"],\"privateEndpoint\":{\"id\":\"rwfndiod\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"w\",\"actionsRequired\":\"dpvwryoqpsoaccta\"},\"provisioningState\":\"Creating\"}") - .toObject(PrivateEndpointConnectionProperties.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, - model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("w", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("dpvwryoqpsoaccta", model.privateLinkServiceConnectionState().actionsRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpointConnectionProperties model - = new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) - .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) - .withDescription("w") - .withActionsRequired("dpvwryoqpsoaccta")); - model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, - model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("w", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("dpvwryoqpsoaccta", model.privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionResourceInnerTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionResourceInnerTests.java deleted file mode 100644 index a0befdddd6c82..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionResourceInnerTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.fluent.models.PrivateEndpointConnectionResourceInner; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpoint; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionProperties; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.mongocluster.models.PrivateLinkServiceConnectionState; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointConnectionResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnectionResourceInner model = BinaryData.fromString( - "{\"properties\":{\"groupIds\":[\"fthwxmnteiwa\",\"pvkmijcmmxdcuf\",\"fsrpymzidnse\"],\"privateEndpoint\":{\"id\":\"tbzsgfyccs\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"dwzjeiach\",\"actionsRequired\":\"osfln\"},\"provisioningState\":\"Deleting\"},\"id\":\"qpteeh\",\"name\":\"zvypyqrimzinp\",\"type\":\"swjdkirso\"}") - .toObject(PrivateEndpointConnectionResourceInner.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, - model.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("dwzjeiach", model.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("osfln", model.properties().privateLinkServiceConnectionState().actionsRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpointConnectionResourceInner model - = new PrivateEndpointConnectionResourceInner() - .withProperties(new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) - .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) - .withDescription("dwzjeiach") - .withActionsRequired("osfln"))); - model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionResourceInner.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, - model.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("dwzjeiach", model.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("osfln", model.properties().privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionResourceListResultTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionResourceListResultTests.java deleted file mode 100644 index 9da4dc1461d7f..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionResourceListResultTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.implementation.models.PrivateEndpointConnectionResourceListResult; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointConnectionResourceListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnectionResourceListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"groupIds\":[\"ulzndlikwyqk\",\"fgibmadgakeq\",\"rxybz\"],\"privateEndpoint\":{\"id\":\"dqytbciqfouflmm\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"modmglougpb\",\"actionsRequired\":\"tmut\"},\"provisioningState\":\"Failed\"},\"id\":\"ta\",\"name\":\"spwgcuertumkdosv\",\"type\":\"whbmd\"},{\"properties\":{\"groupIds\":[\"f\",\"dgmb\",\"bexppb\"],\"privateEndpoint\":{\"id\":\"qrolfpf\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"gbquxigj\",\"actionsRequired\":\"gzjaoyfhrtxilne\"},\"provisioningState\":\"Creating\"},\"id\":\"ysvlejuvf\",\"name\":\"awrlyx\",\"type\":\"jkcpr\"},{\"properties\":{\"groupIds\":[\"xgjvtbv\"],\"privateEndpoint\":{\"id\":\"szdnr\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"uhmuouqfprwzwbn\",\"actionsRequired\":\"itnwuizgazxufi\"},\"provisioningState\":\"Creating\"},\"id\":\"y\",\"name\":\"i\",\"type\":\"rfidfvzwdz\"}],\"nextLink\":\"tymw\"}") - .toObject(PrivateEndpointConnectionResourceListResult.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, - model.value().get(0).properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("modmglougpb", - model.value().get(0).properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("tmut", - model.value().get(0).properties().privateLinkServiceConnectionState().actionsRequired()); - Assertions.assertEquals("tymw", model.nextLink()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionTests.java deleted file mode 100644 index 7b0d7422d0cb4..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnection; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointConnectionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnection model = BinaryData.fromString( - "{\"properties\":{\"groupIds\":[\"fwvuk\",\"gaudcc\",\"nhsjcnyej\"],\"privateEndpoint\":{\"id\":\"yhtnapczwlokjye\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"ni\",\"actionsRequired\":\"oxzjnchgejspod\"},\"provisioningState\":\"Creating\"},\"id\":\"zyde\",\"name\":\"o\",\"type\":\"wyahuxinpmqnja\"}") - .toObject(PrivateEndpointConnection.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, - model.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("ni", model.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("oxzjnchgejspod", - model.properties().privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateMockTests.java deleted file mode 100644 index 678f7fc0bd883..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsCreateMockTests.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpoint; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionProperties; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionResource; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.mongocluster.models.PrivateLinkServiceConnectionState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PrivateEndpointConnectionsCreateMockTests { - @Test - public void testCreate() throws Exception { - String responseStr - = "{\"properties\":{\"groupIds\":[\"hwlrsf\",\"rzpwvlqdqgbiq\",\"lihkaetcktvfc\",\"vf\"],\"privateEndpoint\":{\"id\":\"ymuctqhjfbebrj\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"fuwutttxf\",\"actionsRequired\":\"rbirphxe\"},\"provisioningState\":\"Succeeded\"},\"id\":\"ahfn\",\"name\":\"jky\",\"type\":\"xjvuujqgidokg\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PrivateEndpointConnectionResource response - = manager.privateEndpointConnections() - .define("bin") - .withExistingMongoCluster("wkgshwa", "kix") - .withProperties(new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) - .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) - .withDescription("gyxzk") - .withActionsRequired("ocukoklyax"))) - .create(); - - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, - response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("fuwutttxf", response.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("rbirphxe", - response.properties().privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java deleted file mode 100644 index c1f6c3206b22e..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionResource; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PrivateEndpointConnectionsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"groupIds\":[\"kpoc\",\"pazyxoegukg\",\"npiucgygevqznty\",\"mrbpizcdrqj\"],\"privateEndpoint\":{\"id\":\"ydnfyhxdeoejz\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"fsj\",\"actionsRequired\":\"gzfbishcbk\"},\"provisioningState\":\"Deleting\"},\"id\":\"eyeam\",\"name\":\"p\",\"type\":\"agalpbuxwgipwhon\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PrivateEndpointConnectionResource response = manager.privateEndpointConnections() - .getWithResponse("koen", "ou", "nvudwtiukb", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, - response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("fsj", response.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("gzfbishcbk", - response.properties().privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterMockTests.java deleted file mode 100644 index 512ef57476879..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointConnectionsListByMongoClusterMockTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointConnectionResource; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PrivateEndpointConnectionsListByMongoClusterMockTests { - @Test - public void testListByMongoCluster() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"groupIds\":[\"zfbuhf\"],\"privateEndpoint\":{\"id\":\"axkffei\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"vmezy\",\"actionsRequired\":\"hxmzsbbzoggig\"},\"provisioningState\":\"Failed\"},\"id\":\"ur\",\"name\":\"jx\",\"type\":\"jnspydp\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.privateEndpointConnections() - .listByMongoCluster("onpc", "hocohslkev", com.azure.core.util.Context.NONE); - - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, - response.iterator().next().properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("vmezy", - response.iterator().next().properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("hxmzsbbzoggig", - response.iterator().next().properties().privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointTests.java deleted file mode 100644 index 41770def837fb..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateEndpointTests.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpoint; - -public final class PrivateEndpointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpoint model = BinaryData.fromString("{\"id\":\"j\"}").toObject(PrivateEndpoint.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpoint model = new PrivateEndpoint(); - model = BinaryData.fromObject(model).toObject(PrivateEndpoint.class); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkResourceInnerTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkResourceInnerTests.java deleted file mode 100644 index 4482dc0b01efe..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkResourceInnerTests.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.fluent.models.PrivateLinkResourceInner; -import org.junit.jupiter.api.Assertions; - -public final class PrivateLinkResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateLinkResourceInner model = BinaryData.fromString( - "{\"properties\":{\"groupId\":\"ghmewuam\",\"requiredMembers\":[\"rzayv\",\"t\",\"gvdfgiotkftutq\",\"ln\"],\"requiredZoneNames\":[\"efgugnxk\",\"xdqmidtthzrvqdra\",\"hjybigehoqfbo\"]},\"id\":\"kanyktzlcuiywg\",\"name\":\"ywgndrv\",\"type\":\"nhzgpphrcgyn\"}") - .toObject(PrivateLinkResourceInner.class); - Assertions.assertEquals("efgugnxk", model.properties().requiredZoneNames().get(0)); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkResourceListResultTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkResourceListResultTests.java deleted file mode 100644 index bb12953e189a3..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkResourceListResultTests.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.implementation.models.PrivateLinkResourceListResult; -import org.junit.jupiter.api.Assertions; - -public final class PrivateLinkResourceListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateLinkResourceListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"groupId\":\"hc\",\"requiredMembers\":[\"ohjtckw\",\"dsoifiyipj\"],\"requiredZoneNames\":[\"wpgrjbzno\",\"cjxvsnbyxqab\",\"mocpc\"]},\"id\":\"hurzafblj\",\"name\":\"gpbtoqcjmklj\",\"type\":\"vbqid\"},{\"properties\":{\"groupId\":\"jzyulpk\",\"requiredMembers\":[\"krlkhbzhfepg\",\"gqexzlocxs\",\"paierh\",\"bcsglumma\"],\"requiredZoneNames\":[\"aodxo\"]},\"id\":\"bdxkqpxokaj\",\"name\":\"onpimexgstxg\",\"type\":\"po\"},{\"properties\":{\"groupId\":\"aajrm\",\"requiredMembers\":[\"wzrlovmclwhij\",\"oejctbzaqsqsy\"],\"requiredZoneNames\":[\"bfkgukdkex\",\"ppofmxaxcfjpgdd\"]},\"id\":\"c\",\"name\":\"j\",\"type\":\"hvpmoue\"},{\"properties\":{\"groupId\":\"zxibqeoj\",\"requiredMembers\":[\"bzv\",\"dntwndeicbtw\",\"pzaoqvuhr\"],\"requiredZoneNames\":[\"fcyddg\"]},\"id\":\"jthjqkwpyei\",\"name\":\"xmqci\",\"type\":\"q\"}],\"nextLink\":\"khixuigdtopbo\"}") - .toObject(PrivateLinkResourceListResult.class); - Assertions.assertEquals("wpgrjbzno", model.value().get(0).properties().requiredZoneNames().get(0)); - Assertions.assertEquals("khixuigdtopbo", model.nextLink()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkResourcePropertiesTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkResourcePropertiesTests.java deleted file mode 100644 index 7059d320ded0e..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkResourcePropertiesTests.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.PrivateLinkResourceProperties; -import org.junit.jupiter.api.Assertions; - -public final class PrivateLinkResourcePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateLinkResourceProperties model = BinaryData.fromString( - "{\"groupId\":\"cpecfvmmcoofs\",\"requiredMembers\":[\"evgbmqjq\",\"bcypmi\"],\"requiredZoneNames\":[\"lzu\"]}") - .toObject(PrivateLinkResourceProperties.class); - Assertions.assertEquals("lzu", model.requiredZoneNames().get(0)); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkServiceConnectionStateTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkServiceConnectionStateTests.java deleted file mode 100644 index 8596e0af5a1e1..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinkServiceConnectionStateTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.mongocluster.models.PrivateLinkServiceConnectionState; -import org.junit.jupiter.api.Assertions; - -public final class PrivateLinkServiceConnectionStateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateLinkServiceConnectionState model = BinaryData - .fromString("{\"status\":\"Pending\",\"description\":\"cr\",\"actionsRequired\":\"fdfdosygexpa\"}") - .toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, model.status()); - Assertions.assertEquals("cr", model.description()); - Assertions.assertEquals("fdfdosygexpa", model.actionsRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateLinkServiceConnectionState model - = new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.PENDING) - .withDescription("cr") - .withActionsRequired("fdfdosygexpa"); - model = BinaryData.fromObject(model).toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, model.status()); - Assertions.assertEquals("cr", model.description()); - Assertions.assertEquals("fdfdosygexpa", model.actionsRequired()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterMockTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterMockTests.java deleted file mode 100644 index 0391ce5108353..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PrivateLinksListByMongoClusterMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.mongocluster.MongoClusterManager; -import com.azure.resourcemanager.mongocluster.models.PrivateLinkResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PrivateLinksListByMongoClusterMockTests { - @Test - public void testListByMongoCluster() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"groupId\":\"jhtxfvgxbfsmxne\",\"requiredMembers\":[\"vecxgodebfqkk\",\"bmpukgriwflz\",\"fbxzpuzycisp\"],\"requiredZoneNames\":[\"ahmgkbrp\",\"y\",\"hibnuqqkpika\",\"rgvtqag\"]},\"id\":\"uynhijg\",\"name\":\"mebf\",\"type\":\"iarbutrcvpna\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - MongoClusterManager manager = MongoClusterManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.privateLinks().listByMongoCluster("ljyoxgvcltb", "sncghkjeszz", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ahmgkbrp", response.iterator().next().properties().requiredZoneNames().get(0)); - } -}