diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md b/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md index ca18d519ed771..3d7bba9956274 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-15) + +- 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). ### Features Added diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md b/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md index 0c28919389d27..34073bc8f427a 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/README.md @@ -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..898d16da40e8f 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/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..19aeb1a75d88e 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 @@ -30,11 +30,13 @@ 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,6 +60,8 @@ public final class MongoClusterManager { private PrivateLinks privateLinks; + private Replicas replicas; + private final DocumentDBClient clientObject; private MongoClusterManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -329,6 +333,18 @@ public PrivateLinks privateLinks() { return privateLinks; } + /** + * Gets the resource collection API of Replicas. + * + * @return Resource collection API of Replicas. + */ + public Replicas replicas() { + if (this.replicas == null) { + this.replicas = new ReplicasImpl(clientObject.getReplicas(), this); + } + return replicas; + } + /** * Gets wrapped service client DocumentDBClient providing direct access to the underlying auto-generated API * implementation, based on Azure REST API. 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/DocumentDBClient.java index 38bdf7114dcf6..5220b7f9d9783 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/DocumentDBClient.java @@ -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 b91b684f6710c..a40afbd39028a 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 @@ -16,6 +16,7 @@ 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. @@ -335,4 +336,62 @@ Response checkNameAvailabilityWithResponse(S */ @ServiceMethod(returns = ReturnType.SINGLE) CheckNameAvailabilityResponseInner checkNameAvailability(String location, CheckNameAvailabilityRequest body); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body, Context context); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, Context context); } diff --git a/sdk/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..98541bedcc658 --- /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) TypeSpec 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/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..5da1490e1e556 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/fluent/models/ReplicaInner.java @@ -0,0 +1,155 @@ +// 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.fluent.models; + +import com.azure.core.annotation.Immutable; +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. + */ +@Immutable +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; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ReplicaInner class. + */ + private ReplicaInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public MongoClusterProperties properties() { + return this.properties; + } + + /** + * 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 type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * 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/implementation/DocumentDBClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/DocumentDBClientImpl.java index 8175c14c61ea3..c67154d6c70b6 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/DocumentDBClientImpl.java @@ -29,6 +29,7 @@ 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; @@ -197,6 +198,20 @@ public PrivateLinksClient getPrivateLinks() { return this.privateLinks; } + /** + * The ReplicasClient object to access its operations. + */ + private final ReplicasClient replicas; + + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + public ReplicasClient getReplicas() { + return this.replicas; + } + /** * Initializes an instance of DocumentDBClient client. * @@ -214,12 +229,13 @@ public PrivateLinksClient getPrivateLinks() { this.defaultPollInterval = defaultPollInterval; this.endpoint = endpoint; this.subscriptionId = subscriptionId; - this.apiVersion = "2024-03-01-preview"; + 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); } /** 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..0f774e7d4c2b5 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 @@ -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/MongoClustersClientImpl.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/MongoClustersClientImpl.java index a762da85e6563..92ef7b9ce92df 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 @@ -40,6 +40,7 @@ import com.azure.resourcemanager.mongocluster.implementation.models.MongoClusterListResult; import com.azure.resourcemanager.mongocluster.models.CheckNameAvailabilityRequest; 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; @@ -152,6 +153,16 @@ Mono> checkNameAvailability(@HostPa @PathParam("location") String location, @HeaderParam("accept") String accept, @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/promote") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> promote(@HostParam("endpoint") 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") PromoteReplicaRequest body, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -1463,6 +1474,234 @@ public CheckNameAvailabilityResponseInner checkNameAvailability(String location, return checkNameAvailabilityWithResponse(location, body, Context.NONE).getValue(); } + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> promoteWithResponseAsync(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.promote(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> promoteWithResponseAsync(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mongoClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter mongoClusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.promote(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, accept, body, context); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPromoteAsync(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body) { + Mono>> mono = promoteWithResponseAsync(resourceGroupName, mongoClusterName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPromoteAsync(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = promoteWithResponseAsync(resourceGroupName, mongoClusterName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body) { + return this.beginPromoteAsync(resourceGroupName, mongoClusterName, body).getSyncPoller(); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPromote(String resourceGroupName, String mongoClusterName, + PromoteReplicaRequest body, Context context) { + return this.beginPromoteAsync(resourceGroupName, mongoClusterName, body, context).getSyncPoller(); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono promoteAsync(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body) { + return beginPromoteAsync(resourceGroupName, mongoClusterName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono promoteAsync(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, + Context context) { + return beginPromoteAsync(resourceGroupName, mongoClusterName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body) { + promoteAsync(resourceGroupName, mongoClusterName, body).block(); + } + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, + Context context) { + promoteAsync(resourceGroupName, mongoClusterName, body, context).block(); + } + /** * Get the next page of items. * 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..5085f71661114 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 @@ -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); @@ -124,6 +125,15 @@ public CheckNameAvailabilityResponse checkNameAvailability(String location, Chec } } + public void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body) { + this.serviceClient().promote(resourceGroupName, mongoClusterName, body); + } + + public void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, + Context context) { + this.serviceClient().promote(resourceGroupName, mongoClusterName, body, context); + } + public MongoCluster getById(String id) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { 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..2116312b5836c --- /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) TypeSpec 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..53790bbd00296 --- /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) TypeSpec 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.implementation.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 DocumentDBClientImpl client; + + /** + * Initializes an instance of ReplicasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReplicasClientImpl(DocumentDBClientImpl client) { + this.service = RestProxy.create(ReplicasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DocumentDBClientReplicas to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DocumentDBClientRepl") + 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("endpoint") 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("endpoint") 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..e0373f528d639 --- /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) TypeSpec 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/models/ReplicaListResult.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/ReplicaListResult.java new file mode 100644 index 0000000000000..37784521c477a --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/models/ReplicaListResult.java @@ -0,0 +1,112 @@ +// 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.implementation.models; + +import com.azure.core.annotation.Immutable; +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. + */ +@Immutable +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. + */ + private ReplicaListResult() { + } + + /** + * Get the value property: The Replica items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + 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/CreateMode.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CreateMode.java index 4e3107c7e5b47..c8aaf074098da 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CreateMode.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/CreateMode.java @@ -21,6 +21,16 @@ public final class CreateMode extends ExpandableStringEnum { */ 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/MongoCluster.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoCluster.java index 87acbfa6f7bb9..eab3e9c9995d5 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 @@ -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/models/MongoClusterProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterProperties.java index 2076c9f61d368..0be3c3cd46d1d 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 @@ -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..0415df3d52bab --- /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) TypeSpec 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/MongoClusterUpdateProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterUpdateProperties.java index 8b91a47f98d8d..1575e77b288d3 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 @@ -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 ed38260eeb764..1daaf187c0fa2 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 @@ -158,6 +158,31 @@ Response checkNameAvailabilityWithResponse(String */ CheckNameAvailabilityResponse checkNameAvailability(String location, CheckNameAvailabilityRequest body); + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body); + + /** + * Promotes a replica mongo cluster to a primary role. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mongoClusterName The name of the mongo cluster. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void promote(String resourceGroupName, String mongoClusterName, PromoteReplicaRequest body, Context context); + /** * Gets information about a mongo cluster. * 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..86675f1a31891 --- /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) TypeSpec 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/PromoteMode.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/PromoteMode.java new file mode 100644 index 0000000000000..8836560326b14 --- /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) TypeSpec 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..d2056ac68c2d8 --- /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) TypeSpec 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..76d70b5d0aeea --- /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) TypeSpec 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/Replica.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Replica.java new file mode 100644 index 0000000000000..2c68229a55565 --- /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) TypeSpec 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/Replicas.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/Replicas.java new file mode 100644 index 0000000000000..289465cdb86d0 --- /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) TypeSpec 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..462796819233f --- /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) TypeSpec 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. + */ + private 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..062743aadb1a6 --- /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) TypeSpec 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..9fe1d9d2a589c --- /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) TypeSpec 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/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..05094984e7e6d 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..d25330b64b12c 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..07f22b8e4b956 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..e1069435c1eb7 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..480be708d9f76 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..4f5a6866a415c 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 @@ -6,6 +6,7 @@ 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * MongoClusters_CreatePITR.json */ /** @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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..d34260e257a10 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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..711793697c96a 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/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..34ffdfd3c4352 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..927d0124cefcc 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..99bbbdddabde5 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/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..513234fb576da --- /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) TypeSpec 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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..0ec3854be42a2 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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..38f03a0885ee2 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/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..aad08cde0cfb6 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..2f23e854caf7c 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..c716d980ff8f8 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..5bf15d87e251d 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..ea75954496be4 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 @@ -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/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ * 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..a9112054a5f42 --- /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) TypeSpec Code Generator. + +package com.azure.resourcemanager.mongocluster.generated; + +/** + * Samples for Replicas ListByParent. + */ +public final class ReplicasListByParentSamples { + /* + * x-ms-original-file: + * specification/mongoclustertest/DocumentDB.MongoCluster.Management/examples/2024-06-01-preview/ + * 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 index b461bea044fa0..bb73ee7d646d0 100644 --- 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 @@ -11,17 +11,18 @@ public final class CheckNameAvailabilityRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - CheckNameAvailabilityRequest model = BinaryData.fromString("{\"name\":\"jaeq\",\"type\":\"qjbasvms\"}") + CheckNameAvailabilityRequest model = BinaryData.fromString("{\"name\":\"ugjzzdatqxhocdge\",\"type\":\"lgphu\"}") .toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("jaeq", model.name()); - Assertions.assertEquals("qjbasvms", model.type()); + Assertions.assertEquals("ugjzzdatqxhocdge", model.name()); + Assertions.assertEquals("lgphu", model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - CheckNameAvailabilityRequest model = new CheckNameAvailabilityRequest().withName("jaeq").withType("qjbasvms"); + CheckNameAvailabilityRequest model + = new CheckNameAvailabilityRequest().withName("ugjzzdatqxhocdge").withType("lgphu"); model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("jaeq", model.name()); - Assertions.assertEquals("qjbasvms", model.type()); + Assertions.assertEquals("ugjzzdatqxhocdge", model.name()); + Assertions.assertEquals("lgphu", 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 index ddf5b1007f094..b1552f1ce60bb 100644 --- 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 @@ -12,11 +12,11 @@ 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); + CheckNameAvailabilityResponseInner model + = BinaryData.fromString("{\"nameAvailable\":true,\"reason\":\"Invalid\",\"message\":\"kao\"}") + .toObject(CheckNameAvailabilityResponseInner.class); Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, model.reason()); - Assertions.assertEquals("gsntnbybkzgcwr", model.message()); + Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, model.reason()); + Assertions.assertEquals("kao", 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 index e5d1d04f498e1..40462ad4975de 100644 --- 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 @@ -11,7 +11,7 @@ public final class ConnectionStringTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ConnectionString model - = BinaryData.fromString("{\"connectionString\":\"xgispemvtzfkufu\",\"description\":\"jofxqe\"}") + = BinaryData.fromString("{\"connectionString\":\"wjfeusnhutjel\",\"description\":\"rl\"}") .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 index d6dcd9595e484..204a33115b39c 100644 --- 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 @@ -13,18 +13,18 @@ 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\"}") + "{\"properties\":{\"provisioningState\":\"Failed\",\"startIpAddress\":\"hxh\",\"endIpAddress\":\"rokft\"},\"id\":\"olniwpwcukjf\",\"name\":\"giawx\",\"type\":\"lryplwckbasyy\"}") .toObject(FirewallRuleInner.class); - Assertions.assertEquals("xwrljdouskcqvkoc", model.properties().startIpAddress()); - Assertions.assertEquals("cjdkwtnhxbnjbi", model.properties().endIpAddress()); + Assertions.assertEquals("hxh", model.properties().startIpAddress()); + Assertions.assertEquals("rokft", model.properties().endIpAddress()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FirewallRuleInner model = new FirewallRuleInner().withProperties( - new FirewallRuleProperties().withStartIpAddress("xwrljdouskcqvkoc").withEndIpAddress("cjdkwtnhxbnjbi")); + FirewallRuleInner model = new FirewallRuleInner() + .withProperties(new FirewallRuleProperties().withStartIpAddress("hxh").withEndIpAddress("rokft")); model = BinaryData.fromObject(model).toObject(FirewallRuleInner.class); - Assertions.assertEquals("xwrljdouskcqvkoc", model.properties().startIpAddress()); - Assertions.assertEquals("cjdkwtnhxbnjbi", model.properties().endIpAddress()); + Assertions.assertEquals("hxh", model.properties().startIpAddress()); + Assertions.assertEquals("rokft", 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 index ace39d9f4a92d..ca49363b68b6e 100644 --- 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 @@ -12,10 +12,10 @@ 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\"}") + "{\"value\":[{\"properties\":{\"provisioningState\":\"Updating\",\"startIpAddress\":\"wyqkgfgibm\",\"endIpAddress\":\"dgak\"},\"id\":\"s\",\"name\":\"xybz\",\"type\":\"qedqytbciqfoufl\"},{\"properties\":{\"provisioningState\":\"Failed\",\"startIpAddress\":\"zsm\",\"endIpAddress\":\"dmgloug\"},\"id\":\"kwtmutduqktapspw\",\"name\":\"cuertu\",\"type\":\"kdosvqw\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"startIpAddress\":\"gbbjfddgmbmbe\",\"endIpAddress\":\"ppbhtqqrolfp\"},\"id\":\"s\",\"name\":\"lgbquxig\",\"type\":\"yjgzjaoyfhrtxiln\"},{\"properties\":{\"provisioningState\":\"Updating\",\"startIpAddress\":\"jysvl\",\"endIpAddress\":\"juvf\"},\"id\":\"wrlyxwjkcprb\",\"name\":\"wbxgjvt\",\"type\":\"vpys\"}],\"nextLink\":\"dnrujqguhmuouqfp\"}") .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()); + Assertions.assertEquals("wyqkgfgibm", model.value().get(0).properties().startIpAddress()); + Assertions.assertEquals("dgak", model.value().get(0).properties().endIpAddress()); + Assertions.assertEquals("dnrujqguhmuouqfp", 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 index 6c8333ec75b88..a79acda375169 100644 --- 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 @@ -11,18 +11,19 @@ public final class FirewallRulePropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - FirewallRuleProperties model = BinaryData - .fromString("{\"provisioningState\":\"Canceled\",\"startIpAddress\":\"duuji\",\"endIpAddress\":\"c\"}") + FirewallRuleProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Failed\",\"startIpAddress\":\"dhsgcba\",\"endIpAddress\":\"phejkotynqgoulz\"}") .toObject(FirewallRuleProperties.class); - Assertions.assertEquals("duuji", model.startIpAddress()); - Assertions.assertEquals("c", model.endIpAddress()); + Assertions.assertEquals("dhsgcba", model.startIpAddress()); + Assertions.assertEquals("phejkotynqgoulz", model.endIpAddress()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FirewallRuleProperties model = new FirewallRuleProperties().withStartIpAddress("duuji").withEndIpAddress("c"); + FirewallRuleProperties model + = new FirewallRuleProperties().withStartIpAddress("dhsgcba").withEndIpAddress("phejkotynqgoulz"); model = BinaryData.fromObject(model).toObject(FirewallRuleProperties.class); - Assertions.assertEquals("duuji", model.startIpAddress()); - Assertions.assertEquals("c", model.endIpAddress()); + Assertions.assertEquals("dhsgcba", model.startIpAddress()); + Assertions.assertEquals("phejkotynqgoulz", 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 index c0629c05e6eba..3845375592bff 100644 --- 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 @@ -22,7 +22,7 @@ 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\"}"; + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"startIpAddress\":\"nvudwtiukb\",\"endIpAddress\":\"dng\"},\"id\":\"ocipazyxoeg\",\"name\":\"kgjn\",\"type\":\"iucgygevqzn\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -32,12 +32,12 @@ public void testCreateOrUpdate() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); FirewallRule response = manager.firewallRules() - .define("yokacspkw") - .withExistingMongoCluster("watkpnpulexxb", "zwtruwiqzbqjvsov") - .withProperties(new FirewallRuleProperties().withStartIpAddress("obpxjmflbvvn").withEndIpAddress("hrk")) + .define("eggzfb") + .withExistingMongoCluster("onpc", "hocohslkev") + .withProperties(new FirewallRuleProperties().withStartIpAddress("vfaxkffeiith").withEndIpAddress("vmezy")) .create(); - Assertions.assertEquals("auu", response.properties().startIpAddress()); - Assertions.assertEquals("mjmvxieduugidyjr", response.properties().endIpAddress()); + Assertions.assertEquals("nvudwtiukb", response.properties().startIpAddress()); + Assertions.assertEquals("dng", 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 index b8b1c5dbabef4..eac48c8060faf 100644 --- 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 @@ -21,7 +21,7 @@ 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\"}"; + = "{\"properties\":{\"provisioningState\":\"Updating\",\"startIpAddress\":\"ruwiqzbqjvsov\",\"endIpAddress\":\"yokacspkw\"},\"id\":\"zdobpxjmflbvvnch\",\"name\":\"kcciwwzjuqkhr\",\"type\":\"ajiwkuo\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -31,10 +31,10 @@ public void testGetWithResponse() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); FirewallRule response = manager.firewallRules() - .getWithResponse("zsqpjhvmdajvny", "ounqecano", "eupfhyhltrpm", com.azure.core.util.Context.NONE) + .getWithResponse("oczvy", "fqrvkdvjsllrmvvd", "watkpnpulexxb", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("cma", response.properties().startIpAddress()); - Assertions.assertEquals("u", response.properties().endIpAddress()); + Assertions.assertEquals("ruwiqzbqjvsov", response.properties().startIpAddress()); + Assertions.assertEquals("yokacspkw", 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 index f7ca99bdc0a1a..279c45e6e7fde 100644 --- 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 @@ -22,7 +22,7 @@ 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\"}]}"; + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Dropping\",\"startIpAddress\":\"eduugi\",\"endIpAddress\":\"yjr\"},\"id\":\"byao\",\"name\":\"v\",\"type\":\"xc\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -32,9 +32,9 @@ public void testListByMongoCluster() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response - = manager.firewallRules().listByMongoCluster("twhrdxwzywqsm", "surex", com.azure.core.util.Context.NONE); + = manager.firewallRules().listByMongoCluster("oskg", "sauuimj", com.azure.core.util.Context.NONE); - Assertions.assertEquals("yocf", response.iterator().next().properties().startIpAddress()); - Assertions.assertEquals("fksymddystki", response.iterator().next().properties().endIpAddress()); + Assertions.assertEquals("eduugi", response.iterator().next().properties().startIpAddress()); + Assertions.assertEquals("yjr", 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 index bdfaca04844b0..9c5e54a88b1d8 100644 --- 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 @@ -10,9 +10,8 @@ public final class ListConnectionStringsResultInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ListConnectionStringsResultInner model = BinaryData - .fromString( - "{\"connectionStrings\":[{\"connectionString\":\"vyevcciqi\",\"description\":\"hungbwjzrnf\"}]}") + ListConnectionStringsResultInner model = BinaryData.fromString( + "{\"connectionStrings\":[{\"connectionString\":\"gxsabkyq\",\"description\":\"ujitcjcz\"},{\"connectionString\":\"evndh\",\"description\":\"wpdappdsbdkv\"}]}") .toObject(ListConnectionStringsResultInner.class); } } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClusterReplicaParametersTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClusterReplicaParametersTests.java new file mode 100644 index 0000000000000..bce438653f455 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/MongoClusterReplicaParametersTests.java @@ -0,0 +1,29 @@ +// 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.MongoClusterReplicaParameters; +import org.junit.jupiter.api.Assertions; + +public final class MongoClusterReplicaParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoClusterReplicaParameters model + = BinaryData.fromString("{\"sourceResourceId\":\"ukxgaud\",\"sourceLocation\":\"cs\"}") + .toObject(MongoClusterReplicaParameters.class); + Assertions.assertEquals("ukxgaud", model.sourceResourceId()); + Assertions.assertEquals("cs", model.sourceLocation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoClusterReplicaParameters model + = new MongoClusterReplicaParameters().withSourceResourceId("ukxgaud").withSourceLocation("cs"); + model = BinaryData.fromObject(model).toObject(MongoClusterReplicaParameters.class); + Assertions.assertEquals("ukxgaud", model.sourceResourceId()); + Assertions.assertEquals("cs", model.sourceLocation()); + } +} 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 index 0b1a57fc98dbc..fec4f7f68216b 100644 --- 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 @@ -13,19 +13,19 @@ 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\"}") + = BinaryData.fromString("{\"pointInTimeUTC\":\"2021-10-25T02:57:36Z\",\"sourceResourceId\":\"rtfw\"}") .toObject(MongoClusterRestoreParameters.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-26T12:53:27Z"), model.pointInTimeUTC()); - Assertions.assertEquals("n", model.sourceResourceId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-25T02:57:36Z"), model.pointInTimeUTC()); + Assertions.assertEquals("rtfw", 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"); + = new MongoClusterRestoreParameters().withPointInTimeUTC(OffsetDateTime.parse("2021-10-25T02:57:36Z")) + .withSourceResourceId("rtfw"); model = BinaryData.fromObject(model).toObject(MongoClusterRestoreParameters.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-26T12:53:27Z"), model.pointInTimeUTC()); - Assertions.assertEquals("n", model.sourceResourceId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-25T02:57:36Z"), model.pointInTimeUTC()); + Assertions.assertEquals("rtfw", 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 index a83c527d5026b..41435632897c6 100644 --- 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 @@ -22,7 +22,7 @@ public final class MongoClustersCheckNameAvailabilityWithResponseMockTests { @Test public void testCheckNameAvailabilityWithResponse() throws Exception { - String responseStr = "{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"amdecte\"}"; + String responseStr = "{\"nameAvailable\":false,\"reason\":\"AlreadyExists\",\"message\":\"puozmyzydag\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -32,13 +32,13 @@ public void testCheckNameAvailabilityWithResponse() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); CheckNameAvailabilityResponse response = manager.mongoClusters() - .checkNameAvailabilityWithResponse("uofqwe", - new CheckNameAvailabilityRequest().withName("hmenevfyexfwhybc").withType("vyvdcs"), + .checkNameAvailabilityWithResponse("canoaeupf", + new CheckNameAvailabilityRequest().withName("hltrpmopjmcmatuo").withType("hfuiuaodsfc"), com.azure.core.util.Context.NONE) .getValue(); Assertions.assertEquals(false, response.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, response.reason()); - Assertions.assertEquals("amdecte", response.message()); + Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, response.reason()); + Assertions.assertEquals("puozmyzydag", 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 index 5b4f0a84998f3..130350b07d9da 100644 --- 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 @@ -20,7 +20,7 @@ public final class MongoClustersListConnectionStringsWithResponseMockTests { @Test public void testListConnectionStringsWithResponse() throws Exception { String responseStr - = "{\"connectionStrings\":[{\"connectionString\":\"dnvowg\",\"description\":\"jugwdkcglhsl\"},{\"connectionString\":\"jdyggdtji\",\"description\":\"b\"}]}"; + = "{\"connectionStrings\":[{\"connectionString\":\"scjeypv\",\"description\":\"zrkgqhcjrefovg\"},{\"connectionString\":\"qsl\",\"description\":\"yvxyqjp\"},{\"connectionString\":\"attpngjcrcczsq\",\"description\":\"hvmdajvnysounq\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -30,7 +30,7 @@ public void testListConnectionStringsWithResponse() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); ListConnectionStringsResult response = manager.mongoClusters() - .listConnectionStringsWithResponse("ppusuesnzwdejba", "orxzdmohctbqvud", com.azure.core.util.Context.NONE) + .listConnectionStringsWithResponse("bcibvyvdcsitynn", "amdecte", 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 index 8fe5cfa865f54..c9f95d0f547f3 100644 --- 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 @@ -13,27 +13,27 @@ 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}") + "{\"sku\":\"s\",\"diskSizeGB\":5540769191797474022,\"enableHa\":false,\"kind\":\"Shard\",\"nodeCount\":1707664619}") .toObject(NodeGroupSpec.class); - Assertions.assertEquals("b", model.sku()); - Assertions.assertEquals(7532718659837556043L, model.diskSizeGB()); + Assertions.assertEquals("s", model.sku()); + Assertions.assertEquals(5540769191797474022L, model.diskSizeGB()); Assertions.assertEquals(false, model.enableHa()); Assertions.assertEquals(NodeKind.SHARD, model.kind()); - Assertions.assertEquals(920256064, model.nodeCount()); + Assertions.assertEquals(1707664619, model.nodeCount()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - NodeGroupSpec model = new NodeGroupSpec().withSku("b") - .withDiskSizeGB(7532718659837556043L) + NodeGroupSpec model = new NodeGroupSpec().withSku("s") + .withDiskSizeGB(5540769191797474022L) .withEnableHa(false) .withKind(NodeKind.SHARD) - .withNodeCount(920256064); + .withNodeCount(1707664619); model = BinaryData.fromObject(model).toObject(NodeGroupSpec.class); - Assertions.assertEquals("b", model.sku()); - Assertions.assertEquals(7532718659837556043L, model.diskSizeGB()); + Assertions.assertEquals("s", model.sku()); + Assertions.assertEquals(5540769191797474022L, model.diskSizeGB()); Assertions.assertEquals(false, model.enableHa()); Assertions.assertEquals(NodeKind.SHARD, model.kind()); - Assertions.assertEquals(920256064, model.nodeCount()); + Assertions.assertEquals(1707664619, 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 index 66c3545bedbe8..1a22b0df80882 100644 --- 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 @@ -6,7 +6,6 @@ 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 @@ -14,9 +13,5 @@ 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 index 0b1e004f27426..94e3184ffdf0a 100644 --- 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 @@ -15,10 +15,6 @@ 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 index 747d621981ea7..1e7ee2f242fae 100644 --- 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 @@ -15,10 +15,6 @@ 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 index b4c870d5bbcb1..499f27b77cfb9 100644 --- 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 @@ -23,7 +23,7 @@ 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\"}]}"; + = "{\"value\":[{\"name\":\"gtzxdpn\",\"isDataAction\":false,\"display\":{\"provider\":\"xrjfeallnwsub\",\"resource\":\"njampm\",\"operation\":\"nzscxa\",\"description\":\"ooch\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -34,10 +34,6 @@ public void testList() throws Exception { 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 index af1ff53fc0185..ac460196e656c 100644 --- 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 @@ -15,12 +15,12 @@ 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\"}") + "{\"groupIds\":[\"w\",\"jdpvwryo\"],\"privateEndpoint\":{\"id\":\"oacctaza\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"ahbc\",\"actionsRequired\":\"ffdfdosygexpa\"},\"provisioningState\":\"Deleting\"}") .toObject(PrivateEndpointConnectionProperties.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("w", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("dpvwryoqpsoaccta", model.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("ahbc", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("ffdfdosygexpa", model.privateLinkServiceConnectionState().actionsRequired()); } @org.junit.jupiter.api.Test @@ -28,13 +28,13 @@ public void testSerialize() throws Exception { PrivateEndpointConnectionProperties model = new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) - .withDescription("w") - .withActionsRequired("dpvwryoqpsoaccta")); + new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("ahbc") + .withActionsRequired("ffdfdosygexpa")); model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("w", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("dpvwryoqpsoaccta", model.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("ahbc", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("ffdfdosygexpa", 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 index a0befdddd6c82..7892b945fceb4 100644 --- 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 @@ -16,12 +16,12 @@ 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\"}") + "{\"properties\":{\"groupIds\":[\"hfepgzgqex\"],\"privateEndpoint\":{\"id\":\"c\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"aierhhb\",\"actionsRequired\":\"glu\"},\"provisioningState\":\"Succeeded\"},\"id\":\"tjaodxobnb\",\"name\":\"xkqpxo\",\"type\":\"ajionpimexgstxg\"}") .toObject(PrivateEndpointConnectionResourceInner.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, model.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("dwzjeiach", model.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("osfln", model.properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("aierhhb", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("glu", model.properties().privateLinkServiceConnectionState().actionsRequired()); } @org.junit.jupiter.api.Test @@ -30,13 +30,13 @@ public void testSerialize() throws Exception { = new PrivateEndpointConnectionResourceInner() .withProperties(new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) - .withDescription("dwzjeiach") - .withActionsRequired("osfln"))); + .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) + .withDescription("aierhhb") + .withActionsRequired("glu"))); model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionResourceInner.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, model.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("dwzjeiach", model.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("osfln", model.properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("aierhhb", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("glu", 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 index 9da4dc1461d7f..0abfafb8ec24c 100644 --- 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 @@ -13,14 +13,14 @@ 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\"}") + "{\"value\":[{\"properties\":{\"groupIds\":[\"nguitnwuizgazxu\",\"izuckyfihrfidfvz\"],\"privateEndpoint\":{\"id\":\"uht\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"sdkf\",\"actionsRequired\":\"wxmnteiwao\"},\"provisioningState\":\"Succeeded\"},\"id\":\"ijcmmx\",\"name\":\"cufufsrpymz\",\"type\":\"dnsezcxtbzs\"},{\"properties\":{\"groupIds\":[\"cs\"],\"privateEndpoint\":{\"id\":\"mdwzjeiachboo\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"ro\",\"actionsRequired\":\"qpteeh\"},\"provisioningState\":\"Failed\"},\"id\":\"pyqr\",\"name\":\"mzinpvswjdk\",\"type\":\"rsoodqxhcrmnoh\"},{\"properties\":{\"groupIds\":[\"whdsoifiyip\"],\"privateEndpoint\":{\"id\":\"qwpgrjbzn\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"xv\",\"actionsRequired\":\"byxqabn\"},\"provisioningState\":\"Succeeded\"},\"id\":\"cyshurzafbljjgp\",\"name\":\"toqcjmklja\",\"type\":\"bqidtqaj\"}],\"nextLink\":\"ulpkudjkrl\"}") .toObject(PrivateEndpointConnectionResourceListResult.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, model.value().get(0).properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("modmglougpb", + Assertions.assertEquals("sdkf", model.value().get(0).properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("tmut", + Assertions.assertEquals("wxmnteiwao", model.value().get(0).properties().privateLinkServiceConnectionState().actionsRequired()); - Assertions.assertEquals("tymw", model.nextLink()); + Assertions.assertEquals("ulpkudjkrl", 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 index 7b0d7422d0cb4..b83cd341b46c4 100644 --- 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 @@ -13,12 +13,13 @@ 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\"}") + "{\"properties\":{\"groupIds\":[\"apcz\",\"lokjyemkk\",\"ni\"],\"privateEndpoint\":{\"id\":\"xzjnchgejs\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"ailzydehojwyahu\",\"actionsRequired\":\"npmqnjaqwixjspro\"},\"provisioningState\":\"Failed\"},\"id\":\"utegjvwmfdats\",\"name\":\"mdvpjhulsu\",\"type\":\"vmkjozkrwfndiodj\"}") .toObject(PrivateEndpointConnection.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, model.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("ni", model.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("oxzjnchgejspod", + Assertions.assertEquals("ailzydehojwyahu", + model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("npmqnjaqwixjspro", 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 index 678f7fc0bd883..0e71d8d836023 100644 --- 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 @@ -25,7 +25,7 @@ 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\"}"; + = "{\"properties\":{\"groupIds\":[\"xgodebfqkkrbmp\",\"kgriwflzlfbx\"],\"privateEndpoint\":{\"id\":\"zycispn\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"mgkbrpyydhibn\",\"actionsRequired\":\"qkpikadrgvtqagnb\"},\"provisioningState\":\"Succeeded\"},\"id\":\"ijggmebfsiar\",\"name\":\"utrc\",\"type\":\"pnazzm\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -36,19 +36,20 @@ public void testCreate() throws Exception { PrivateEndpointConnectionResource response = manager.privateEndpointConnections() - .define("bin") - .withExistingMongoCluster("wkgshwa", "kix") + .define("jf") + .withExistingMongoCluster("fcivfsnkym", "ctq") .withProperties(new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) - .withDescription("gyxzk") - .withActionsRequired("ocukoklyax"))) + .withDescription("qxj") + .withActionsRequired("ujqgidok"))) .create(); Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("fuwutttxf", response.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("rbirphxe", + Assertions.assertEquals("mgkbrpyydhibn", + response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("qkpikadrgvtqagnb", 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 index c1f6c3206b22e..5d4bcbcd7d637 100644 --- 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 @@ -22,7 +22,7 @@ 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\"}"; + = "{\"properties\":{\"groupIds\":[\"nwvlryavwhheunmm\",\"hgyxzkonoc\"],\"privateEndpoint\":{\"id\":\"klyaxuconu\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"kbeype\",\"actionsRequired\":\"mjmwvvjektcx\"},\"provisioningState\":\"Failed\"},\"id\":\"wlrsffrzpwv\",\"name\":\"qdqgbi\",\"type\":\"ylihkaetckt\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -32,13 +32,13 @@ public void testGetWithResponse() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PrivateEndpointConnectionResource response = manager.privateEndpointConnections() - .getWithResponse("koen", "ou", "nvudwtiukb", com.azure.core.util.Context.NONE) + .getWithResponse("uzoqft", "yqzrnkcqvyxlw", "zlsico", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("fsj", response.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("gzfbishcbk", + Assertions.assertEquals("kbeype", response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("mjmwvvjektcx", 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 index 512ef57476879..835693bc94497 100644 --- 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 @@ -23,7 +23,7 @@ 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\"}]}"; + = "{\"value\":[{\"properties\":{\"groupIds\":[\"sdpydnfyhxdeoejz\"],\"privateEndpoint\":{\"id\":\"ifsjttgzfbishcb\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"deyeamdphagalpbu\",\"actionsRequired\":\"gipwhonowkg\"},\"provisioningState\":\"Deleting\"},\"id\":\"nkixzbinj\",\"name\":\"pu\",\"type\":\"tmryw\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -32,14 +32,14 @@ public void testListByMongoCluster() throws Exception { .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); + PagedIterable response + = manager.privateEndpointConnections().listByMongoCluster("yp", "rbpizc", com.azure.core.util.Context.NONE); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, response.iterator().next().properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("vmezy", + Assertions.assertEquals("deyeamdphagalpbu", response.iterator().next().properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("hxmzsbbzoggig", + Assertions.assertEquals("gipwhonowkg", 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 index 41770def837fb..01b25c4c03dd5 100644 --- 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 @@ -10,7 +10,7 @@ public final class PrivateEndpointTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - PrivateEndpoint model = BinaryData.fromString("{\"id\":\"j\"}").toObject(PrivateEndpoint.class); + PrivateEndpoint model = BinaryData.fromString("{\"id\":\"hmsbzjhcrzevdp\"}").toObject(PrivateEndpoint.class); } @org.junit.jupiter.api.Test 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 index 4482dc0b01efe..ddbfcb2ca8092 100644 --- 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 @@ -12,8 +12,8 @@ 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\"}") + "{\"properties\":{\"groupId\":\"wndeicbtwnp\",\"requiredMembers\":[\"qvuhrhcffcyddglm\",\"t\"],\"requiredZoneNames\":[\"kw\",\"yeicxmqciwqvhk\",\"ixuigdtopbobj\"]},\"id\":\"hm\",\"name\":\"w\",\"type\":\"a\"}") .toObject(PrivateLinkResourceInner.class); - Assertions.assertEquals("efgugnxk", model.properties().requiredZoneNames().get(0)); + Assertions.assertEquals("kw", 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 index bb12953e189a3..0c3ed29da3709 100644 --- 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 @@ -12,9 +12,9 @@ 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\"}") + "{\"value\":[{\"properties\":{\"groupId\":\"gmaajrm\",\"requiredMembers\":[\"wzrlovmclwhij\",\"oejctbzaqsqsy\"],\"requiredZoneNames\":[\"bfkgukdkex\",\"ppofmxaxcfjpgdd\"]},\"id\":\"c\",\"name\":\"j\",\"type\":\"hvpmoue\"}],\"nextLink\":\"dzxibqeojnxqbzvd\"}") .toObject(PrivateLinkResourceListResult.class); - Assertions.assertEquals("wpgrjbzno", model.value().get(0).properties().requiredZoneNames().get(0)); - Assertions.assertEquals("khixuigdtopbo", model.nextLink()); + Assertions.assertEquals("bfkgukdkex", model.value().get(0).properties().requiredZoneNames().get(0)); + Assertions.assertEquals("dzxibqeojnxqbzvd", 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 index 7059d320ded0e..2156750956c2f 100644 --- 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 @@ -12,8 +12,8 @@ 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\"]}") + "{\"groupId\":\"uhrzayvvt\",\"requiredMembers\":[\"dfgiot\",\"ftutqxlngxlefgu\"],\"requiredZoneNames\":[\"krxd\",\"mi\"]}") .toObject(PrivateLinkResourceProperties.class); - Assertions.assertEquals("lzu", model.requiredZoneNames().get(0)); + Assertions.assertEquals("krxd", 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 index 8596e0af5a1e1..527b1ec12c7fd 100644 --- 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 @@ -13,22 +13,23 @@ public final class PrivateLinkServiceConnectionStateTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { PrivateLinkServiceConnectionState model = BinaryData - .fromString("{\"status\":\"Pending\",\"description\":\"cr\",\"actionsRequired\":\"fdfdosygexpa\"}") + .fromString( + "{\"status\":\"Rejected\",\"description\":\"olthqtrgqjbp\",\"actionsRequired\":\"fsinzgvfcjrwzoxx\"}") .toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, model.status()); - Assertions.assertEquals("cr", model.description()); - Assertions.assertEquals("fdfdosygexpa", model.actionsRequired()); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, model.status()); + Assertions.assertEquals("olthqtrgqjbp", model.description()); + Assertions.assertEquals("fsinzgvfcjrwzoxx", model.actionsRequired()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PrivateLinkServiceConnectionState model - = new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.PENDING) - .withDescription("cr") - .withActionsRequired("fdfdosygexpa"); + = new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) + .withDescription("olthqtrgqjbp") + .withActionsRequired("fsinzgvfcjrwzoxx"); model = BinaryData.fromObject(model).toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, model.status()); - Assertions.assertEquals("cr", model.description()); - Assertions.assertEquals("fdfdosygexpa", model.actionsRequired()); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, model.status()); + Assertions.assertEquals("olthqtrgqjbp", model.description()); + Assertions.assertEquals("fsinzgvfcjrwzoxx", 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 index 0391ce5108353..c3c8aeb31f0b6 100644 --- 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 @@ -22,7 +22,7 @@ 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\"}]}"; + = "{\"value\":[{\"properties\":{\"groupId\":\"l\",\"requiredMembers\":[\"xmyskp\"],\"requiredZoneNames\":[\"nbtkcxywnytnr\",\"yn\",\"qidybyx\"]},\"id\":\"fclhaaxdbabphlwr\",\"name\":\"lfktsths\",\"type\":\"cocmnyyaztt\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -32,8 +32,8 @@ public void testListByMongoCluster() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response - = manager.privateLinks().listByMongoCluster("ljyoxgvcltb", "sncghkjeszz", com.azure.core.util.Context.NONE); + = manager.privateLinks().listByMongoCluster("jrunmpxtt", "bh", com.azure.core.util.Context.NONE); - Assertions.assertEquals("ahmgkbrp", response.iterator().next().properties().requiredZoneNames().get(0)); + Assertions.assertEquals("nbtkcxywnytnr", response.iterator().next().properties().requiredZoneNames().get(0)); } } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PromoteReplicaRequestTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PromoteReplicaRequestTests.java new file mode 100644 index 0000000000000..733d09e6ee5dd --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/PromoteReplicaRequestTests.java @@ -0,0 +1,30 @@ +// 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.PromoteMode; +import com.azure.resourcemanager.mongocluster.models.PromoteOption; +import com.azure.resourcemanager.mongocluster.models.PromoteReplicaRequest; +import org.junit.jupiter.api.Assertions; + +public final class PromoteReplicaRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PromoteReplicaRequest model = BinaryData.fromString("{\"promoteOption\":\"Forced\",\"mode\":\"Switchover\"}") + .toObject(PromoteReplicaRequest.class); + Assertions.assertEquals(PromoteOption.FORCED, model.promoteOption()); + Assertions.assertEquals(PromoteMode.SWITCHOVER, model.mode()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PromoteReplicaRequest model + = new PromoteReplicaRequest().withPromoteOption(PromoteOption.FORCED).withMode(PromoteMode.SWITCHOVER); + model = BinaryData.fromObject(model).toObject(PromoteReplicaRequest.class); + Assertions.assertEquals(PromoteOption.FORCED, model.promoteOption()); + Assertions.assertEquals(PromoteMode.SWITCHOVER, model.mode()); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ReplicationPropertiesTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ReplicationPropertiesTests.java new file mode 100644 index 0000000000000..20000f3547cb7 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ReplicationPropertiesTests.java @@ -0,0 +1,18 @@ +// 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.ReplicationProperties; + +public final class ReplicationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationProperties model = BinaryData + .fromString( + "{\"sourceResourceId\":\"felluwfzitonpe\",\"role\":\"AsyncReplica\",\"replicationState\":\"Updating\"}") + .toObject(ReplicationProperties.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/tsp-location.yaml b/sdk/mongocluster/azure-resourcemanager-mongocluster/tsp-location.yaml index 15039ca457d05..177aad0d9e4f7 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/tsp-location.yaml +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/tsp-location.yaml @@ -1,4 +1,4 @@ -directory: specification/mongocluster/DocumentDB.MongoCluster.Management -commit: 7ed015e3dd1b8b1b0e71c9b5e6b6c5ccb8968b3a -repo: Azure/azure-rest-api-specs -additionalDirectories: null +directory: specification/mongoclustertest/DocumentDB.MongoCluster.Management +commit: 8387ea3d827cb70dbfd8c4a6627e669d7598d5aa +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: \ No newline at end of file