diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md b/sdk/mongocluster/azure-resourcemanager-mongocluster/CHANGELOG.md index ca18d519ed771..c4c9d706e9031 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-29) + +- 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..8beccb3647da3 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,8 +48,7 @@ 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/ - * MongoClusters_FirewallRuleCreate.json + * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleCreate.json */ /** * Sample code: Creates a firewall rule on a Mongo Cluster resource. @@ -71,8 +75,7 @@ public final class FirewallRulesCreateOrUpdateSamples { */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_FirewallRuleDelete.json + * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleDelete.json */ /** * Sample code: Deletes a firewall rule on a Mongo Cluster resource. @@ -94,8 +97,7 @@ public final class FirewallRulesDeleteSamples { */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_FirewallRuleGet.json + * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleGet.json */ /** * Sample code: Gets a firewall rule on a Mongo Cluster resource. @@ -118,8 +120,7 @@ public final class FirewallRulesGetSamples { */ public final class FirewallRulesListByMongoClusterSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_FirewallRuleList.json + * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleList.json */ /** * Sample code: List the firewall rules on a Mongo Cluster resource. @@ -143,8 +144,7 @@ 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/ - * MongoClusters_NameAvailability.json + * x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability.json */ /** * Sample code: Checks and confirms the Mongo Cluster name is availability for use. @@ -157,25 +157,90 @@ public final class MongoClustersCheckNameAvailabilitySamples { .checkNameAvailabilityWithResponse("westus2", new CheckNameAvailabilityRequest().withName("newmongocluster") .withType("Microsoft.DocumentDB/mongoClusters"), com.azure.core.util.Context.NONE); } + + /* + * x-ms-original-file: 2024-07-01/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.AdministratorProperties; +import com.azure.resourcemanager.mongocluster.models.ComputeProperties; +import com.azure.resourcemanager.mongocluster.models.CreateMode; +import com.azure.resourcemanager.mongocluster.models.HighAvailabilityMode; +import com.azure.resourcemanager.mongocluster.models.HighAvailabilityProperties; import com.azure.resourcemanager.mongocluster.models.MongoClusterProperties; -import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; -import com.azure.resourcemanager.mongocluster.models.NodeKind; -import java.util.Arrays; +import com.azure.resourcemanager.mongocluster.models.MongoClusterReplicaParameters; +import com.azure.resourcemanager.mongocluster.models.MongoClusterRestoreParameters; +import com.azure.resourcemanager.mongocluster.models.ShardingProperties; +import com.azure.resourcemanager.mongocluster.models.StorageProperties; +import java.time.OffsetDateTime; /** * Samples for MongoClusters CreateOrUpdate. */ public final class MongoClustersCreateOrUpdateSamples { /* - * x-ms-original-file: - * specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/MongoClusters_Create. - * json + * x-ms-original-file: 2024-07-01/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: 2024-07-01/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: 2024-07-01/MongoClusters_Create.json */ /** * Sample code: Creates a new Mongo Cluster resource. @@ -188,14 +253,14 @@ public final class MongoClustersCreateOrUpdateSamples { .define("myMongoCluster") .withRegion("westus2") .withExistingResourceGroup("TestResourceGroup") - .withProperties(new MongoClusterProperties().withAdministratorLogin("mongoAdmin") - .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withProperties(new MongoClusterProperties() + .withAdministrator( + new AdministratorProperties().withUserName("mongoAdmin").withPassword("fakeTokenPlaceholder")) .withServerVersion("5.0") - .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withSku("M30") - .withDiskSizeGB(128L) - .withEnableHa(true) - .withKind(NodeKind.SHARD) - .withNodeCount(1)))) + .withHighAvailability(new HighAvailabilityProperties().withTargetMode(HighAvailabilityMode.SAME_ZONE)) + .withStorage(new StorageProperties().withSizeGb(128L)) + .withSharding(new ShardingProperties().withShardCount(1)) + .withCompute(new ComputeProperties().withTier("M30"))) .create(); } } @@ -209,9 +274,7 @@ 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 + * x-ms-original-file: 2024-07-01/MongoClusters_Delete.json */ /** * Sample code: Deletes a Mongo Cluster resource. @@ -233,8 +296,7 @@ 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 + * x-ms-original-file: 2024-07-01/MongoClusters_Get.json */ /** * Sample code: Gets a Mongo Cluster resource. @@ -256,8 +318,7 @@ 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 + * x-ms-original-file: 2024-07-01/MongoClusters_List.json */ /** * Sample code: Lists the Mongo Cluster resources in a subscription. @@ -279,8 +340,7 @@ public final class MongoClustersListSamples { */ public final class MongoClustersListByResourceGroupSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_ListByResourceGroup.json + * x-ms-original-file: 2024-07-01/MongoClusters_ListByResourceGroup.json */ /** * Sample code: Lists the Mongo Cluster resources in a resource group. @@ -302,8 +362,7 @@ public final class MongoClustersListByResourceGroupSamples { */ public final class MongoClustersListConnectionStringsSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_ListConnectionStrings.json + * x-ms-original-file: 2024-07-01/MongoClusters_ListConnectionStrings.json */ /** * Sample code: List the available connection strings for the Mongo Cluster resource. @@ -318,13 +377,47 @@ 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: 2024-07-01/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 +import com.azure.resourcemanager.mongocluster.models.AdministratorProperties; +import com.azure.resourcemanager.mongocluster.models.ComputeProperties; +import com.azure.resourcemanager.mongocluster.models.HighAvailabilityMode; +import com.azure.resourcemanager.mongocluster.models.HighAvailabilityProperties; 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 com.azure.resourcemanager.mongocluster.models.ShardingProperties; +import com.azure.resourcemanager.mongocluster.models.StorageProperties; import java.util.Arrays; /** @@ -332,8 +425,26 @@ import java.util.Arrays; */ public final class MongoClustersUpdateSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_PatchDiskSize.json + * x-ms-original-file: 2024-07-01/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().withAdministrator( + new AdministratorProperties().withUserName("mongoAdmin").withPassword("fakeTokenPlaceholder"))) + .apply(); + } + + /* + * x-ms-original-file: 2024-07-01/MongoClusters_PatchDiskSize.json */ /** * Sample code: Updates the disk size on a Mongo Cluster resource. @@ -342,12 +453,55 @@ public final class MongoClustersUpdateSamples { */ public static void updatesTheDiskSizeOnAMongoClusterResource(com.azure.resourcemanager.mongocluster.MongoClusterManager manager) { + MongoCluster resource = manager.mongoClusters() + .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new MongoClusterUpdateProperties().withStorage(new StorageProperties().withSizeGb(256L))) + .apply(); + } + + /* + * x-ms-original-file: 2024-07-01/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: 2024-07-01/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() - .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withDiskSizeGB(256L).withKind(NodeKind.SHARD)))) + .withAdministrator(new AdministratorProperties().withUserName("mongoAdmin")) + .withServerVersion("5.0") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withHighAvailability(new HighAvailabilityProperties().withTargetMode(HighAvailabilityMode.SAME_ZONE)) + .withStorage(new StorageProperties().withSizeGb(256L)) + .withSharding(new ShardingProperties().withShardCount(4)) + .withCompute(new ComputeProperties().withTier("M50")) + .withPreviewFeatures(Arrays.asList())) .apply(); } } @@ -361,8 +515,7 @@ 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 + * x-ms-original-file: 2024-07-01/Operations_List.json */ /** * Sample code: Operations_List. @@ -387,8 +540,7 @@ 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/ - * MongoClusters_PrivateEndpointConnectionPut.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json */ /** * Sample code: Approves a private endpoint connection on a Mongo Cluster resource. @@ -416,8 +568,7 @@ public final class PrivateEndpointConnectionsCreateSamples { */ public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_PrivateEndpointConnectionDelete.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json */ /** * Sample code: Delete a private endpoint connection on a Mongo Cluster resource. @@ -441,8 +592,7 @@ public final class PrivateEndpointConnectionsDeleteSamples { */ public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_PrivateEndpointConnectionGet.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json */ /** * Sample code: Get a private endpoint connection on a Mongo Cluster resource. @@ -466,8 +616,7 @@ public final class PrivateEndpointConnectionsGetSamples { */ public final class PrivateEndpointConnectionsListByMongoClusterSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_PrivateEndpointConnectionList.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json */ /** * Sample code: Lists the private endpoint connection resources on a Mongo Cluster resource. @@ -490,8 +639,7 @@ public final class PrivateEndpointConnectionsListByMongoClusterSamples { */ public final class PrivateLinksListByMongoClusterSamples { /* - * x-ms-original-file: specification/mongocluster/DocumentDB.MongoCluster.Management/examples/2024-03-01-preview/ - * MongoClusters_PrivateLinkResourceList.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateLinkResourceList.json */ /** * Sample code: Lists the private link resources available on a Mongo Cluster resource. @@ -505,3 +653,25 @@ public final class PrivateLinksListByMongoClusterSamples { } ``` +### Replicas_ListByParent + +```java +/** + * Samples for Replicas ListByParent. + */ +public final class ReplicasListByParentSamples { + /* + * x-ms-original-file: 2024-07-01/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 c59d30e3fab65..de814429de486 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 c9102253ca2db..5ee06f37ac644 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-07-01"; 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 afdea8b37757e..317e85114290d 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 @HeaderParam("Accept") String accept, @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); + @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("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") PromoteReplicaRequest body, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -1473,6 +1484,235 @@ 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.promote(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mongoClusterName, contentType, 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.promote(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mongoClusterName, contentType, 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(); + } + /** * List all the mongo clusters in a given resource group. * 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..5379096bb09e2 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/implementation/ReplicasClientImpl.java @@ -0,0 +1,285 @@ +// 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)); + } + + /** + * List all the replicas for the mongo cluster. + * + * 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())); + } + + /** + * List all the replicas for the mongo cluster. + * + * 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/AdministratorProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/AdministratorProperties.java new file mode 100644 index 0000000000000..3ad87e2a82409 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/AdministratorProperties.java @@ -0,0 +1,121 @@ +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The local administrator login properties. + */ +@Fluent +public final class AdministratorProperties implements JsonSerializable { + /* + * The administrator user name. + */ + private String userName; + + /* + * The administrator password. + */ + private String password; + + /** + * Creates an instance of AdministratorProperties class. + */ + public AdministratorProperties() { + } + + /** + * Get the userName property: The administrator user name. + * + * @return the userName value. + */ + public String userName() { + return this.userName; + } + + /** + * Set the userName property: The administrator user name. + * + * @param userName the userName value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get the password property: The administrator password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The administrator password. + * + * @param password the password value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("userName", this.userName); + jsonWriter.writeStringField("password", this.password); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdministratorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdministratorProperties 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 AdministratorProperties. + */ + public static AdministratorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdministratorProperties deserializedAdministratorProperties = new AdministratorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userName".equals(fieldName)) { + deserializedAdministratorProperties.userName = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedAdministratorProperties.password = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAdministratorProperties; + }); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/BackupProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/BackupProperties.java new file mode 100644 index 0000000000000..05a40d1a68856 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/BackupProperties.java @@ -0,0 +1,81 @@ +// 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; + +/** + * The backup properties of the cluster. This includes the earliest restore time and retention settings. + */ +@Immutable +public final class BackupProperties implements JsonSerializable { + /* + * Earliest restore timestamp in UTC ISO8601 format. + */ + private String earliestRestoreTime; + + /** + * Creates an instance of BackupProperties class. + */ + public BackupProperties() { + } + + /** + * Get the earliestRestoreTime property: Earliest restore timestamp in UTC ISO8601 format. + * + * @return the earliestRestoreTime value. + */ + public String earliestRestoreTime() { + return this.earliestRestoreTime; + } + + /** + * 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 BackupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupProperties 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 BackupProperties. + */ + public static BackupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupProperties deserializedBackupProperties = new BackupProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("earliestRestoreTime".equals(fieldName)) { + deserializedBackupProperties.earliestRestoreTime = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupProperties; + }); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ComputeProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ComputeProperties.java new file mode 100644 index 0000000000000..e8dcd285042d6 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ComputeProperties.java @@ -0,0 +1,97 @@ +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The compute properties of the cluster. This includes the virtual-cores/memory and scaling options applied to servers + * in the cluster. + */ +@Fluent +public final class ComputeProperties implements JsonSerializable { + /* + * The compute tier to assign to the cluster, where each tier maps to a virtual-core and memory size. Example + * values: 'M30', 'M40'. + */ + private String tier; + + /** + * Creates an instance of ComputeProperties class. + */ + public ComputeProperties() { + } + + /** + * Get the tier property: The compute tier to assign to the cluster, where each tier maps to a virtual-core and + * memory size. Example values: 'M30', 'M40'. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: The compute tier to assign to the cluster, where each tier maps to a virtual-core and + * memory size. Example values: 'M30', 'M40'. + * + * @param tier the tier value to set. + * @return the ComputeProperties object itself. + */ + public ComputeProperties withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tier", this.tier); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComputeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComputeProperties 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 ComputeProperties. + */ + public static ComputeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComputeProperties deserializedComputeProperties = new ComputeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tier".equals(fieldName)) { + deserializedComputeProperties.tier = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedComputeProperties; + }); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java index 14fc3246b8e8f..dd11e9c0a000c 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ConnectionString.java @@ -26,6 +26,11 @@ public final class ConnectionString implements JsonSerializable { */ public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + /** + * Static value GeoReplica for CreateMode. + */ + public static final CreateMode GEO_REPLICA = fromString("GeoReplica"); + + /** + * Static value Replica for CreateMode. + */ + public static final CreateMode REPLICA = fromString("Replica"); + /** * Creates a new instance of CreateMode value. * diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/HighAvailabilityMode.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/HighAvailabilityMode.java new file mode 100644 index 0000000000000..13f7605c6c478 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/HighAvailabilityMode.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; + +/** + * The high availability modes for a cluster. + */ +public final class HighAvailabilityMode extends ExpandableStringEnum { + /** + * Static value Disabled for HighAvailabilityMode. + */ + public static final HighAvailabilityMode DISABLED = fromString("Disabled"); + + /** + * Static value SameZone for HighAvailabilityMode. + */ + public static final HighAvailabilityMode SAME_ZONE = fromString("SameZone"); + + /** + * Static value ZoneRedundantPreferred for HighAvailabilityMode. + */ + public static final HighAvailabilityMode ZONE_REDUNDANT_PREFERRED = fromString("ZoneRedundantPreferred"); + + /** + * Creates a new instance of HighAvailabilityMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HighAvailabilityMode() { + } + + /** + * Creates or finds a HighAvailabilityMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding HighAvailabilityMode. + */ + public static HighAvailabilityMode fromString(String name) { + return fromString(name, HighAvailabilityMode.class); + } + + /** + * Gets known HighAvailabilityMode values. + * + * @return known HighAvailabilityMode values. + */ + public static Collection values() { + return values(HighAvailabilityMode.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/HighAvailabilityProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/HighAvailabilityProperties.java new file mode 100644 index 0000000000000..64a1f8fff9cc0 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/HighAvailabilityProperties.java @@ -0,0 +1,94 @@ +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The high availability properties of the cluster. + */ +@Fluent +public final class HighAvailabilityProperties implements JsonSerializable { + /* + * The target high availability mode requested for the cluster. + */ + private HighAvailabilityMode targetMode; + + /** + * Creates an instance of HighAvailabilityProperties class. + */ + public HighAvailabilityProperties() { + } + + /** + * Get the targetMode property: The target high availability mode requested for the cluster. + * + * @return the targetMode value. + */ + public HighAvailabilityMode targetMode() { + return this.targetMode; + } + + /** + * Set the targetMode property: The target high availability mode requested for the cluster. + * + * @param targetMode the targetMode value to set. + * @return the HighAvailabilityProperties object itself. + */ + public HighAvailabilityProperties withTargetMode(HighAvailabilityMode targetMode) { + this.targetMode = targetMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetMode", this.targetMode == null ? null : this.targetMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HighAvailabilityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HighAvailabilityProperties 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 HighAvailabilityProperties. + */ + public static HighAvailabilityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HighAvailabilityProperties deserializedHighAvailabilityProperties = new HighAvailabilityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetMode".equals(fieldName)) { + deserializedHighAvailabilityProperties.targetMode + = HighAvailabilityMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedHighAvailabilityProperties; + }); + } +} 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..8500f1d1295c5 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 @@ -28,14 +28,14 @@ public final class MongoClusterProperties implements JsonSerializable nodeGroupSpecs; + private ShardingProperties sharding; + + /* + * The compute properties of the mongo cluster. + */ + private ComputeProperties compute; + + /* + * The backup properties of the mongo cluster. + */ + private BackupProperties backup; /* * List of private endpoint connections. */ private List privateEndpointConnections; + /* + * List of private endpoint connections. + */ + private List previewFeatures; + + /* + * The replication properties for the mongo cluster + */ + private ReplicationProperties replica; + + /* + * The infrastructure version the cluster is provisioned on. + */ + private String infrastructureVersion; + /** * Creates an instance of MongoClusterProperties class. */ @@ -124,42 +154,42 @@ public MongoClusterProperties withRestoreParameters(MongoClusterRestoreParameter } /** - * Get the administratorLogin property: The administrator's login for the mongo cluster. + * Get the replicaParameters property: The parameters to create a replica mongo cluster. * - * @return the administratorLogin value. + * @return the replicaParameters value. */ - public String administratorLogin() { - return this.administratorLogin; + public MongoClusterReplicaParameters replicaParameters() { + return this.replicaParameters; } /** - * Set the administratorLogin property: The administrator's login for the mongo cluster. + * Set the replicaParameters property: The parameters to create a replica mongo cluster. * - * @param administratorLogin the administratorLogin value to set. + * @param replicaParameters the replicaParameters value to set. * @return the MongoClusterProperties object itself. */ - public MongoClusterProperties withAdministratorLogin(String administratorLogin) { - this.administratorLogin = administratorLogin; + public MongoClusterProperties withReplicaParameters(MongoClusterReplicaParameters replicaParameters) { + this.replicaParameters = replicaParameters; return this; } /** - * Get the administratorLoginPassword property: The password of the administrator login. + * Get the administrator property: The local administrator properties for the mongo cluster. * - * @return the administratorLoginPassword value. + * @return the administrator value. */ - public String administratorLoginPassword() { - return this.administratorLoginPassword; + public AdministratorProperties administrator() { + return this.administrator; } /** - * Set the administratorLoginPassword property: The password of the administrator login. + * Set the administrator property: The local administrator properties for the mongo cluster. * - * @param administratorLoginPassword the administratorLoginPassword value to set. + * @param administrator the administrator value to set. * @return the MongoClusterProperties object itself. */ - public MongoClusterProperties withAdministratorLoginPassword(String administratorLoginPassword) { - this.administratorLoginPassword = administratorLoginPassword; + public MongoClusterProperties withAdministrator(AdministratorProperties administrator) { + this.administrator = administrator; return this; } @@ -194,15 +224,6 @@ public String connectionString() { return this.connectionString; } - /** - * Get the earliestRestoreTime property: Earliest restore timestamp in UTC ISO8601 format. - * - * @return the earliestRestoreTime value. - */ - public String earliestRestoreTime() { - return this.earliestRestoreTime; - } - /** * Get the provisioningState property: The provisioning state of the mongo cluster. * @@ -242,22 +263,102 @@ public MongoClusterProperties withPublicNetworkAccess(PublicNetworkAccess public } /** - * Get the nodeGroupSpecs property: The list of node group specs in the cluster. + * Get the highAvailability property: The high availability properties of the mongo cluster. + * + * @return the highAvailability value. + */ + public HighAvailabilityProperties highAvailability() { + return this.highAvailability; + } + + /** + * Set the highAvailability property: The high availability properties of the mongo cluster. + * + * @param highAvailability the highAvailability value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withHighAvailability(HighAvailabilityProperties highAvailability) { + this.highAvailability = highAvailability; + return this; + } + + /** + * Get the storage property: The storage properties of the mongo cluster. + * + * @return the storage value. + */ + public StorageProperties storage() { + return this.storage; + } + + /** + * Set the storage property: The storage properties of the mongo cluster. + * + * @param storage the storage value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withStorage(StorageProperties storage) { + this.storage = storage; + return this; + } + + /** + * Get the sharding property: The sharding properties of the mongo cluster. * - * @return the nodeGroupSpecs value. + * @return the sharding value. */ - public List nodeGroupSpecs() { - return this.nodeGroupSpecs; + public ShardingProperties sharding() { + return this.sharding; } /** - * Set the nodeGroupSpecs property: The list of node group specs in the cluster. + * Set the sharding property: The sharding properties of the mongo cluster. * - * @param nodeGroupSpecs the nodeGroupSpecs value to set. + * @param sharding the sharding value to set. * @return the MongoClusterProperties object itself. */ - public MongoClusterProperties withNodeGroupSpecs(List nodeGroupSpecs) { - this.nodeGroupSpecs = nodeGroupSpecs; + public MongoClusterProperties withSharding(ShardingProperties sharding) { + this.sharding = sharding; + return this; + } + + /** + * Get the compute property: The compute properties of the mongo cluster. + * + * @return the compute value. + */ + public ComputeProperties compute() { + return this.compute; + } + + /** + * Set the compute property: The compute properties of the mongo cluster. + * + * @param compute the compute value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withCompute(ComputeProperties compute) { + this.compute = compute; + return this; + } + + /** + * Get the backup property: The backup properties of the mongo cluster. + * + * @return the backup value. + */ + public BackupProperties backup() { + return this.backup; + } + + /** + * Set the backup property: The backup properties of the mongo cluster. + * + * @param backup the backup value to set. + * @return the MongoClusterProperties object itself. + */ + public MongoClusterProperties withBackup(BackupProperties backup) { + this.backup = backup; return this; } @@ -270,6 +371,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 +418,33 @@ public void validate() { if (restoreParameters() != null) { restoreParameters().validate(); } - if (nodeGroupSpecs() != null) { - nodeGroupSpecs().forEach(e -> e.validate()); + if (replicaParameters() != null) { + replicaParameters().validate(); + } + if (administrator() != null) { + administrator().validate(); + } + if (highAvailability() != null) { + highAvailability().validate(); + } + if (storage() != null) { + storage().validate(); + } + if (sharding() != null) { + sharding().validate(); + } + if (compute() != null) { + compute().validate(); + } + if (backup() != null) { + backup().validate(); } if (privateEndpointConnections() != null) { privateEndpointConnections().forEach(e -> e.validate()); } + if (replica() != null) { + replica().validate(); + } } /** @@ -295,13 +455,18 @@ 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.writeStringField("administratorLogin", this.administratorLogin); - jsonWriter.writeStringField("administratorLoginPassword", this.administratorLoginPassword); + jsonWriter.writeJsonField("replicaParameters", this.replicaParameters); + jsonWriter.writeJsonField("administrator", this.administrator); jsonWriter.writeStringField("serverVersion", this.serverVersion); jsonWriter.writeStringField("publicNetworkAccess", this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); - jsonWriter.writeArrayField("nodeGroupSpecs", this.nodeGroupSpecs, - (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("highAvailability", this.highAvailability); + jsonWriter.writeJsonField("storage", this.storage); + jsonWriter.writeJsonField("sharding", this.sharding); + jsonWriter.writeJsonField("compute", this.compute); + jsonWriter.writeJsonField("backup", this.backup); + jsonWriter.writeArrayField("previewFeatures", this.previewFeatures, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); return jsonWriter.writeEndObject(); } @@ -325,16 +490,15 @@ public static MongoClusterProperties fromJson(JsonReader jsonReader) throws IOEx } else if ("restoreParameters".equals(fieldName)) { deserializedMongoClusterProperties.restoreParameters = MongoClusterRestoreParameters.fromJson(reader); - } else if ("administratorLogin".equals(fieldName)) { - deserializedMongoClusterProperties.administratorLogin = reader.getString(); - } else if ("administratorLoginPassword".equals(fieldName)) { - deserializedMongoClusterProperties.administratorLoginPassword = reader.getString(); + } else if ("replicaParameters".equals(fieldName)) { + deserializedMongoClusterProperties.replicaParameters + = MongoClusterReplicaParameters.fromJson(reader); + } else if ("administrator".equals(fieldName)) { + deserializedMongoClusterProperties.administrator = AdministratorProperties.fromJson(reader); } else if ("serverVersion".equals(fieldName)) { deserializedMongoClusterProperties.serverVersion = reader.getString(); } else if ("connectionString".equals(fieldName)) { deserializedMongoClusterProperties.connectionString = reader.getString(); - } else if ("earliestRestoreTime".equals(fieldName)) { - deserializedMongoClusterProperties.earliestRestoreTime = reader.getString(); } else if ("provisioningState".equals(fieldName)) { deserializedMongoClusterProperties.provisioningState = ProvisioningState.fromString(reader.getString()); @@ -344,13 +508,28 @@ public static MongoClusterProperties fromJson(JsonReader jsonReader) throws IOEx } else if ("publicNetworkAccess".equals(fieldName)) { deserializedMongoClusterProperties.publicNetworkAccess = PublicNetworkAccess.fromString(reader.getString()); - } else if ("nodeGroupSpecs".equals(fieldName)) { - List nodeGroupSpecs = reader.readArray(reader1 -> NodeGroupSpec.fromJson(reader1)); - deserializedMongoClusterProperties.nodeGroupSpecs = nodeGroupSpecs; + } else if ("highAvailability".equals(fieldName)) { + deserializedMongoClusterProperties.highAvailability = HighAvailabilityProperties.fromJson(reader); + } else if ("storage".equals(fieldName)) { + deserializedMongoClusterProperties.storage = StorageProperties.fromJson(reader); + } else if ("sharding".equals(fieldName)) { + deserializedMongoClusterProperties.sharding = ShardingProperties.fromJson(reader); + } else if ("compute".equals(fieldName)) { + deserializedMongoClusterProperties.compute = ComputeProperties.fromJson(reader); + } else if ("backup".equals(fieldName)) { + deserializedMongoClusterProperties.backup = BackupProperties.fromJson(reader); } else if ("privateEndpointConnections".equals(fieldName)) { List privateEndpointConnections = reader.readArray(reader1 -> PrivateEndpointConnection.fromJson(reader1)); deserializedMongoClusterProperties.privateEndpointConnections = privateEndpointConnections; + } else if ("previewFeatures".equals(fieldName)) { + List previewFeatures + = reader.readArray(reader1 -> PreviewFeature.fromString(reader1.getString())); + deserializedMongoClusterProperties.previewFeatures = previewFeatures; + } else if ("replica".equals(fieldName)) { + deserializedMongoClusterProperties.replica = ReplicationProperties.fromJson(reader); + } else if ("infrastructureVersion".equals(fieldName)) { + deserializedMongoClusterProperties.infrastructureVersion = reader.getString(); } else { reader.skipChildren(); } 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/MongoClusterStatus.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java index b469f54827b3b..b9b244f8b98d9 100644 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/MongoClusterStatus.java @@ -46,6 +46,11 @@ public final class MongoClusterStatus extends ExpandableStringEnum { /* - * The administrator's login for the mongo cluster. + * The local administrator properties for the mongo cluster. */ - private String administratorLogin; - - /* - * The password of the administrator login. - */ - private String administratorLoginPassword; + private AdministratorProperties administrator; /* * The Mongo DB server version. Defaults to the latest available version if not specified. @@ -38,53 +33,58 @@ public final class MongoClusterUpdateProperties implements JsonSerializable nodeGroupSpecs; + private HighAvailabilityProperties highAvailability; - /** - * Creates an instance of MongoClusterUpdateProperties class. + /* + * The storage properties of the mongo cluster. */ - public MongoClusterUpdateProperties() { - } + private StorageProperties storage; - /** - * Get the administratorLogin property: The administrator's login for the mongo cluster. - * - * @return the administratorLogin value. + /* + * The sharding properties of the mongo cluster. */ - public String administratorLogin() { - return this.administratorLogin; - } + private ShardingProperties sharding; + + /* + * The compute properties of the mongo cluster. + */ + private ComputeProperties compute; + + /* + * The backup properties of the mongo cluster. + */ + private BackupProperties backup; + + /* + * List of private endpoint connections. + */ + private List previewFeatures; /** - * Set the administratorLogin property: The administrator's login for the mongo cluster. - * - * @param administratorLogin the administratorLogin value to set. - * @return the MongoClusterUpdateProperties object itself. + * Creates an instance of MongoClusterUpdateProperties class. */ - public MongoClusterUpdateProperties withAdministratorLogin(String administratorLogin) { - this.administratorLogin = administratorLogin; - return this; + public MongoClusterUpdateProperties() { } /** - * Get the administratorLoginPassword property: The password of the administrator login. + * Get the administrator property: The local administrator properties for the mongo cluster. * - * @return the administratorLoginPassword value. + * @return the administrator value. */ - public String administratorLoginPassword() { - return this.administratorLoginPassword; + public AdministratorProperties administrator() { + return this.administrator; } /** - * Set the administratorLoginPassword property: The password of the administrator login. + * Set the administrator property: The local administrator properties for the mongo cluster. * - * @param administratorLoginPassword the administratorLoginPassword value to set. + * @param administrator the administrator value to set. * @return the MongoClusterUpdateProperties object itself. */ - public MongoClusterUpdateProperties withAdministratorLoginPassword(String administratorLoginPassword) { - this.administratorLoginPassword = administratorLoginPassword; + public MongoClusterUpdateProperties withAdministrator(AdministratorProperties administrator) { + this.administrator = administrator; return this; } @@ -131,22 +131,122 @@ public MongoClusterUpdateProperties withPublicNetworkAccess(PublicNetworkAccess } /** - * Get the nodeGroupSpecs property: The list of node group specs in the cluster. + * Get the highAvailability property: The high availability properties of the mongo cluster. * - * @return the nodeGroupSpecs value. + * @return the highAvailability value. */ - public List nodeGroupSpecs() { - return this.nodeGroupSpecs; + public HighAvailabilityProperties highAvailability() { + return this.highAvailability; } /** - * Set the nodeGroupSpecs property: The list of node group specs in the cluster. + * Set the highAvailability property: The high availability properties of the mongo cluster. * - * @param nodeGroupSpecs the nodeGroupSpecs value to set. + * @param highAvailability the highAvailability value to set. * @return the MongoClusterUpdateProperties object itself. */ - public MongoClusterUpdateProperties withNodeGroupSpecs(List nodeGroupSpecs) { - this.nodeGroupSpecs = nodeGroupSpecs; + public MongoClusterUpdateProperties withHighAvailability(HighAvailabilityProperties highAvailability) { + this.highAvailability = highAvailability; + return this; + } + + /** + * Get the storage property: The storage properties of the mongo cluster. + * + * @return the storage value. + */ + public StorageProperties storage() { + return this.storage; + } + + /** + * Set the storage property: The storage properties of the mongo cluster. + * + * @param storage the storage value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withStorage(StorageProperties storage) { + this.storage = storage; + return this; + } + + /** + * Get the sharding property: The sharding properties of the mongo cluster. + * + * @return the sharding value. + */ + public ShardingProperties sharding() { + return this.sharding; + } + + /** + * Set the sharding property: The sharding properties of the mongo cluster. + * + * @param sharding the sharding value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withSharding(ShardingProperties sharding) { + this.sharding = sharding; + return this; + } + + /** + * Get the compute property: The compute properties of the mongo cluster. + * + * @return the compute value. + */ + public ComputeProperties compute() { + return this.compute; + } + + /** + * Set the compute property: The compute properties of the mongo cluster. + * + * @param compute the compute value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withCompute(ComputeProperties compute) { + this.compute = compute; + return this; + } + + /** + * Get the backup property: The backup properties of the mongo cluster. + * + * @return the backup value. + */ + public BackupProperties backup() { + return this.backup; + } + + /** + * Set the backup property: The backup properties of the mongo cluster. + * + * @param backup the backup value to set. + * @return the MongoClusterUpdateProperties object itself. + */ + public MongoClusterUpdateProperties withBackup(BackupProperties backup) { + this.backup = backup; + 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; } @@ -156,8 +256,23 @@ public MongoClusterUpdateProperties withNodeGroupSpecs(List nodeG * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (nodeGroupSpecs() != null) { - nodeGroupSpecs().forEach(e -> e.validate()); + if (administrator() != null) { + administrator().validate(); + } + if (highAvailability() != null) { + highAvailability().validate(); + } + if (storage() != null) { + storage().validate(); + } + if (sharding() != null) { + sharding().validate(); + } + if (compute() != null) { + compute().validate(); + } + if (backup() != null) { + backup().validate(); } } @@ -167,13 +282,17 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("administratorLogin", this.administratorLogin); - jsonWriter.writeStringField("administratorLoginPassword", this.administratorLoginPassword); + jsonWriter.writeJsonField("administrator", this.administrator); jsonWriter.writeStringField("serverVersion", this.serverVersion); jsonWriter.writeStringField("publicNetworkAccess", this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); - jsonWriter.writeArrayField("nodeGroupSpecs", this.nodeGroupSpecs, - (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("highAvailability", this.highAvailability); + jsonWriter.writeJsonField("storage", this.storage); + jsonWriter.writeJsonField("sharding", this.sharding); + jsonWriter.writeJsonField("compute", this.compute); + jsonWriter.writeJsonField("backup", this.backup); + jsonWriter.writeArrayField("previewFeatures", this.previewFeatures, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); return jsonWriter.writeEndObject(); } @@ -192,18 +311,28 @@ public static MongoClusterUpdateProperties fromJson(JsonReader jsonReader) throw String fieldName = reader.getFieldName(); reader.nextToken(); - if ("administratorLogin".equals(fieldName)) { - deserializedMongoClusterUpdateProperties.administratorLogin = reader.getString(); - } else if ("administratorLoginPassword".equals(fieldName)) { - deserializedMongoClusterUpdateProperties.administratorLoginPassword = reader.getString(); + if ("administrator".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.administrator = AdministratorProperties.fromJson(reader); } else if ("serverVersion".equals(fieldName)) { deserializedMongoClusterUpdateProperties.serverVersion = reader.getString(); } else if ("publicNetworkAccess".equals(fieldName)) { deserializedMongoClusterUpdateProperties.publicNetworkAccess = PublicNetworkAccess.fromString(reader.getString()); - } else if ("nodeGroupSpecs".equals(fieldName)) { - List nodeGroupSpecs = reader.readArray(reader1 -> NodeGroupSpec.fromJson(reader1)); - deserializedMongoClusterUpdateProperties.nodeGroupSpecs = nodeGroupSpecs; + } else if ("highAvailability".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.highAvailability + = HighAvailabilityProperties.fromJson(reader); + } else if ("storage".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.storage = StorageProperties.fromJson(reader); + } else if ("sharding".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.sharding = ShardingProperties.fromJson(reader); + } else if ("compute".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.compute = ComputeProperties.fromJson(reader); + } else if ("backup".equals(fieldName)) { + deserializedMongoClusterUpdateProperties.backup = BackupProperties.fromJson(reader); + } 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/NodeGroupSpec.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java deleted file mode 100644 index 0d8be2cd17c9a..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeGroupSpec.java +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Specification for a node group. - */ -@Fluent -public final class NodeGroupSpec implements JsonSerializable { - /* - * The resource sku for the node group. This defines the size of CPU and memory that is provisioned for each node. - * Example values: 'M30', 'M40'. - */ - private String sku; - - /* - * The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. - */ - private Long diskSizeGB; - - /* - * Whether high availability is enabled on the node group. - */ - private Boolean enableHa; - - /* - * The node type deployed in the node group. - */ - private NodeKind kind; - - /* - * The number of nodes in the node group. - */ - private Integer nodeCount; - - /** - * Creates an instance of NodeGroupSpec class. - */ - public NodeGroupSpec() { - } - - /** - * Get the sku property: The resource sku for the node group. This defines the size of CPU and memory that is - * provisioned for each node. Example values: 'M30', 'M40'. - * - * @return the sku value. - */ - public String sku() { - return this.sku; - } - - /** - * Set the sku property: The resource sku for the node group. This defines the size of CPU and memory that is - * provisioned for each node. Example values: 'M30', 'M40'. - * - * @param sku the sku value to set. - * @return the NodeGroupSpec object itself. - */ - public NodeGroupSpec withSku(String sku) { - this.sku = sku; - return this; - } - - /** - * Get the diskSizeGB property: The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. - * - * @return the diskSizeGB value. - */ - public Long diskSizeGB() { - return this.diskSizeGB; - } - - /** - * Set the diskSizeGB property: The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. - * - * @param diskSizeGB the diskSizeGB value to set. - * @return the NodeGroupSpec object itself. - */ - public NodeGroupSpec withDiskSizeGB(Long diskSizeGB) { - this.diskSizeGB = diskSizeGB; - return this; - } - - /** - * Get the enableHa property: Whether high availability is enabled on the node group. - * - * @return the enableHa value. - */ - public Boolean enableHa() { - return this.enableHa; - } - - /** - * Set the enableHa property: Whether high availability is enabled on the node group. - * - * @param enableHa the enableHa value to set. - * @return the NodeGroupSpec object itself. - */ - public NodeGroupSpec withEnableHa(Boolean enableHa) { - this.enableHa = enableHa; - return this; - } - - /** - * Get the kind property: The node type deployed in the node group. - * - * @return the kind value. - */ - public NodeKind kind() { - return this.kind; - } - - /** - * Set the kind property: The node type deployed in the node group. - * - * @param kind the kind value to set. - * @return the NodeGroupSpec object itself. - */ - public NodeGroupSpec withKind(NodeKind kind) { - this.kind = kind; - return this; - } - - /** - * Get the nodeCount property: The number of nodes in the node group. - * - * @return the nodeCount value. - */ - public Integer nodeCount() { - return this.nodeCount; - } - - /** - * Set the nodeCount property: The number of nodes in the node group. - * - * @param nodeCount the nodeCount value to set. - * @return the NodeGroupSpec object itself. - */ - public NodeGroupSpec withNodeCount(Integer nodeCount) { - this.nodeCount = nodeCount; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("sku", this.sku); - jsonWriter.writeNumberField("diskSizeGB", this.diskSizeGB); - jsonWriter.writeBooleanField("enableHa", this.enableHa); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - jsonWriter.writeNumberField("nodeCount", this.nodeCount); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NodeGroupSpec from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NodeGroupSpec if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the NodeGroupSpec. - */ - public static NodeGroupSpec fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NodeGroupSpec deserializedNodeGroupSpec = new NodeGroupSpec(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("sku".equals(fieldName)) { - deserializedNodeGroupSpec.sku = reader.getString(); - } else if ("diskSizeGB".equals(fieldName)) { - deserializedNodeGroupSpec.diskSizeGB = reader.getNullable(JsonReader::getLong); - } else if ("enableHa".equals(fieldName)) { - deserializedNodeGroupSpec.enableHa = reader.getNullable(JsonReader::getBoolean); - } else if ("kind".equals(fieldName)) { - deserializedNodeGroupSpec.kind = NodeKind.fromString(reader.getString()); - } else if ("nodeCount".equals(fieldName)) { - deserializedNodeGroupSpec.nodeCount = reader.getNullable(JsonReader::getInt); - } else { - reader.skipChildren(); - } - } - - return deserializedNodeGroupSpec; - }); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java deleted file mode 100644 index 5636767e526a3..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/NodeKind.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * The kind of the node on the cluster. - */ -public final class NodeKind extends ExpandableStringEnum { - /** - * Static value Shard for NodeKind. - */ - public static final NodeKind SHARD = fromString("Shard"); - - /** - * Creates a new instance of NodeKind value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public NodeKind() { - } - - /** - * Creates or finds a NodeKind from its string representation. - * - * @param name a name to look for. - * @return the corresponding NodeKind. - */ - public static NodeKind fromString(String name) { - return fromString(name, NodeKind.class); - } - - /** - * Gets known NodeKind values. - * - * @return known NodeKind values. - */ - public static Collection values() { - return values(NodeKind.class); - } -} diff --git a/sdk/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/java/com/azure/resourcemanager/mongocluster/models/ShardingProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ShardingProperties.java new file mode 100644 index 0000000000000..6f92937059f54 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/ShardingProperties.java @@ -0,0 +1,93 @@ +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The sharding properties of the cluster. This includes the shard count and scaling options for the cluster. + */ +@Fluent +public final class ShardingProperties implements JsonSerializable { + /* + * Number of shards to provision on the cluster. + */ + private Integer shardCount; + + /** + * Creates an instance of ShardingProperties class. + */ + public ShardingProperties() { + } + + /** + * Get the shardCount property: Number of shards to provision on the cluster. + * + * @return the shardCount value. + */ + public Integer shardCount() { + return this.shardCount; + } + + /** + * Set the shardCount property: Number of shards to provision on the cluster. + * + * @param shardCount the shardCount value to set. + * @return the ShardingProperties object itself. + */ + public ShardingProperties withShardCount(Integer shardCount) { + this.shardCount = shardCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("shardCount", this.shardCount); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ShardingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ShardingProperties 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 ShardingProperties. + */ + public static ShardingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ShardingProperties deserializedShardingProperties = new ShardingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("shardCount".equals(fieldName)) { + deserializedShardingProperties.shardCount = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedShardingProperties; + }); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/StorageProperties.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/StorageProperties.java new file mode 100644 index 0000000000000..bb89bd63dcc0a --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/main/java/com/azure/resourcemanager/mongocluster/models/StorageProperties.java @@ -0,0 +1,94 @@ +// 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The storage properties of the cluster. This includes the data storage size and scaling applied to servers in the + * cluster. + */ +@Fluent +public final class StorageProperties implements JsonSerializable { + /* + * The size of the data disk assigned to each server. + */ + private Long sizeGb; + + /** + * Creates an instance of StorageProperties class. + */ + public StorageProperties() { + } + + /** + * Get the sizeGb property: The size of the data disk assigned to each server. + * + * @return the sizeGb value. + */ + public Long sizeGb() { + return this.sizeGb; + } + + /** + * Set the sizeGb property: The size of the data disk assigned to each server. + * + * @param sizeGb the sizeGb value to set. + * @return the StorageProperties object itself. + */ + public StorageProperties withSizeGb(Long sizeGb) { + this.sizeGb = sizeGb; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("sizeGb", this.sizeGb); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageProperties 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 StorageProperties. + */ + public static StorageProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageProperties deserializedStorageProperties = new StorageProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sizeGb".equals(fieldName)) { + deserializedStorageProperties.sizeGb = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageProperties; + }); + } +} 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 aeba7a743c010..6e11833fcb927 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,7 @@ */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_FirewallRuleCreate.json + * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleCreate.json */ /** * Sample code: Creates a firewall rule on a Mongo Cluster resource. 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 306d31d568c4d..4f6d4ca1b06ea 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,7 @@ */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_FirewallRuleDelete.json + * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleDelete.json */ /** * Sample code: Deletes a firewall rule on a Mongo Cluster resource. 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 40e9cf8845a11..6405457102ce6 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,7 @@ */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_FirewallRuleGet.json + * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleGet.json */ /** * Sample code: Gets a firewall rule on a Mongo Cluster resource. 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 c83512a21e244..6f5872795e987 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,7 @@ */ public final class FirewallRulesListByMongoClusterSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_FirewallRuleList.json + * x-ms-original-file: 2024-07-01/MongoClusters_FirewallRuleList.json */ /** * Sample code: List the firewall rules on a Mongo Cluster resource. 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 638936725ea69..eb2099974fab9 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,7 @@ */ public final class MongoClustersCheckNameAvailabilitySamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_NameAvailability.json + * x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability.json */ /** * Sample code: Checks and confirms the Mongo Cluster name is availability for use. @@ -26,7 +26,7 @@ public static void checksAndConfirmsTheMongoClusterNameIsAvailabilityForUse( } /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_NameAvailability_AlreadyExists.json + * x-ms-original-file: 2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json */ /** * Sample code: Checks and returns that the Mongo Cluster name is already in-use. 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 4df02141250ef..1ebddefc4843c 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 @@ -4,20 +4,45 @@ package com.azure.resourcemanager.mongocluster.generated; +import com.azure.resourcemanager.mongocluster.models.AdministratorProperties; +import com.azure.resourcemanager.mongocluster.models.ComputeProperties; import com.azure.resourcemanager.mongocluster.models.CreateMode; +import com.azure.resourcemanager.mongocluster.models.HighAvailabilityMode; +import com.azure.resourcemanager.mongocluster.models.HighAvailabilityProperties; 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 com.azure.resourcemanager.mongocluster.models.ShardingProperties; +import com.azure.resourcemanager.mongocluster.models.StorageProperties; import java.time.OffsetDateTime; -import java.util.Arrays; /** * Samples for MongoClusters CreateOrUpdate. */ public final class MongoClustersCreateOrUpdateSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_CreatePITR.json + * x-ms-original-file: 2024-07-01/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: 2024-07-01/MongoClusters_CreatePITR.json */ /** * Sample code: Creates a Mongo Cluster resource from a point in time restore. @@ -39,7 +64,7 @@ public static void createsAMongoClusterResourceFromAPointInTimeRestore( } /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_Create.json + * x-ms-original-file: 2024-07-01/MongoClusters_Create.json */ /** * Sample code: Creates a new Mongo Cluster resource. @@ -52,14 +77,14 @@ public static void createsAMongoClusterResourceFromAPointInTimeRestore( .define("myMongoCluster") .withRegion("westus2") .withExistingResourceGroup("TestResourceGroup") - .withProperties(new MongoClusterProperties().withAdministratorLogin("mongoAdmin") - .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withProperties(new MongoClusterProperties() + .withAdministrator( + new AdministratorProperties().withUserName("mongoAdmin").withPassword("fakeTokenPlaceholder")) .withServerVersion("5.0") - .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withSku("M30") - .withDiskSizeGB(128L) - .withEnableHa(true) - .withKind(NodeKind.SHARD) - .withNodeCount(1)))) + .withHighAvailability(new HighAvailabilityProperties().withTargetMode(HighAvailabilityMode.SAME_ZONE)) + .withStorage(new StorageProperties().withSizeGb(128L)) + .withSharding(new ShardingProperties().withShardCount(1)) + .withCompute(new ComputeProperties().withTier("M30"))) .create(); } } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersDeleteSamples.java index 34da87affa165..e4608cda29680 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 @@ -9,7 +9,7 @@ */ public final class MongoClustersDeleteSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_Delete.json + * x-ms-original-file: 2024-07-01/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 6edc490326390..8e3c662ede83f 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 @@ -9,7 +9,7 @@ */ public final class MongoClustersGetByResourceGroupSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_Get.json + * x-ms-original-file: 2024-07-01/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 97912b0164d23..32fff6b5b5081 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,7 @@ */ public final class MongoClustersListByResourceGroupSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_ListByResourceGroup.json + * x-ms-original-file: 2024-07-01/MongoClusters_ListByResourceGroup.json */ /** * Sample code: Lists the Mongo Cluster resources in a resource group. 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 074ce336a148c..7bafeb2fe3689 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,7 @@ */ public final class MongoClustersListConnectionStringsSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_ListConnectionStrings.json + * x-ms-original-file: 2024-07-01/MongoClusters_ListConnectionStrings.json */ /** * Sample code: List the available connection strings for the Mongo Cluster resource. 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 2e670db5f8168..b5d902f848466 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 @@ -9,7 +9,7 @@ */ public final class MongoClustersListSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_List.json + * x-ms-original-file: 2024-07-01/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..3d9c9ba51ef44 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/MongoClustersPromoteSamples.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.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: 2024-07-01/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 ed9fe2ee0a666..fa97da9c846f3 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 @@ -4,11 +4,15 @@ package com.azure.resourcemanager.mongocluster.generated; +import com.azure.resourcemanager.mongocluster.models.AdministratorProperties; +import com.azure.resourcemanager.mongocluster.models.ComputeProperties; +import com.azure.resourcemanager.mongocluster.models.HighAvailabilityMode; +import com.azure.resourcemanager.mongocluster.models.HighAvailabilityProperties; 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 com.azure.resourcemanager.mongocluster.models.ShardingProperties; +import com.azure.resourcemanager.mongocluster.models.StorageProperties; import java.util.Arrays; /** @@ -16,7 +20,26 @@ */ public final class MongoClustersUpdateSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_PatchDiskSize.json + * x-ms-original-file: 2024-07-01/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().withAdministrator( + new AdministratorProperties().withUserName("mongoAdmin").withPassword("fakeTokenPlaceholder"))) + .apply(); + } + + /* + * x-ms-original-file: 2024-07-01/MongoClusters_PatchDiskSize.json */ /** * Sample code: Updates the disk size on a Mongo Cluster resource. @@ -29,13 +52,12 @@ public final class MongoClustersUpdateSamples { .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) .getValue(); resource.update() - .withProperties(new MongoClusterUpdateProperties() - .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withDiskSizeGB(256L).withKind(NodeKind.SHARD)))) + .withProperties(new MongoClusterUpdateProperties().withStorage(new StorageProperties().withSizeGb(256L))) .apply(); } /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_PatchPrivateNetworkAccess.json + * x-ms-original-file: 2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json */ /** * Sample code: Disables public network access on a Mongo Cluster resource with a private endpoint connection. @@ -53,7 +75,7 @@ public static void disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivat } /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_Update.json + * x-ms-original-file: 2024-07-01/MongoClusters_Update.json */ /** * Sample code: Updates a Mongo Cluster resource. @@ -66,15 +88,15 @@ public static void disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivat .getByResourceGroupWithResponse("TestResourceGroup", "myMongoCluster", com.azure.core.util.Context.NONE) .getValue(); resource.update() - .withProperties(new MongoClusterUpdateProperties().withAdministratorLogin("mongoAdmin") - .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withProperties(new MongoClusterUpdateProperties() + .withAdministrator(new AdministratorProperties().withUserName("mongoAdmin")) .withServerVersion("5.0") .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) - .withNodeGroupSpecs(Arrays.asList(new NodeGroupSpec().withSku("M50") - .withDiskSizeGB(256L) - .withEnableHa(true) - .withKind(NodeKind.SHARD) - .withNodeCount(1)))) + .withHighAvailability(new HighAvailabilityProperties().withTargetMode(HighAvailabilityMode.SAME_ZONE)) + .withStorage(new StorageProperties().withSizeGb(256L)) + .withSharding(new ShardingProperties().withShardCount(4)) + .withCompute(new ComputeProperties().withTier("M50")) + .withPreviewFeatures(Arrays.asList())) .apply(); } } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/OperationsListSamples.java index a5547e98f815c..d251fb3d91797 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 @@ -9,7 +9,7 @@ */ public final class OperationsListSamples { /* - * x-ms-original-file: 2024-03-01-preview/Operations_List.json + * x-ms-original-file: 2024-07-01/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 c8410fc57fcd3..3d92d1f63d074 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,7 @@ */ public final class PrivateEndpointConnectionsCreateSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_PrivateEndpointConnectionPut.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json */ /** * Sample code: Approves a private endpoint connection on a Mongo Cluster resource. 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 1eeb5e444dd51..db9ba788b1984 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,7 @@ */ public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_PrivateEndpointConnectionDelete.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json */ /** * Sample code: Delete a private endpoint connection on a Mongo Cluster resource. 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 b5e7d74d0ef2c..0c213919533e1 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,7 @@ */ public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_PrivateEndpointConnectionGet.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json */ /** * Sample code: Get a private endpoint connection on a Mongo Cluster resource. 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 9b099718e7e09..7f1fdcf686906 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,7 @@ */ public final class PrivateEndpointConnectionsListByMongoClusterSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_PrivateEndpointConnectionList.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json */ /** * Sample code: Lists the private endpoint connection resources on a Mongo Cluster resource. 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 8728206bc0a75..c7a346ac9627d 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,7 @@ */ public final class PrivateLinksListByMongoClusterSamples { /* - * x-ms-original-file: 2024-03-01-preview/MongoClusters_PrivateLinkResourceList.json + * x-ms-original-file: 2024-07-01/MongoClusters_PrivateLinkResourceList.json */ /** * Sample code: Lists the private link resources available on a Mongo Cluster resource. 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..bb627d70b0bc3 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/samples/java/com/azure/resourcemanager/mongocluster/generated/ReplicasListByParentSamples.java @@ -0,0 +1,23 @@ +// 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: 2024-07-01/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/BackupPropertiesTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/BackupPropertiesTests.java new file mode 100644 index 0000000000000..09f4dff4bbbec --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/BackupPropertiesTests.java @@ -0,0 +1,22 @@ +// 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.BackupProperties; + +public final class BackupPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BackupProperties model + = BinaryData.fromString("{\"earliestRestoreTime\":\"prozvcputegjvwmf\"}").toObject(BackupProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BackupProperties model = new BackupProperties(); + model = BinaryData.fromObject(model).toObject(BackupProperties.class); + } +} 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..b1d0aeb950967 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,19 @@ public final class CheckNameAvailabilityRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - CheckNameAvailabilityRequest model = BinaryData.fromString("{\"name\":\"jaeq\",\"type\":\"qjbasvms\"}") - .toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("jaeq", model.name()); - Assertions.assertEquals("qjbasvms", model.type()); + CheckNameAvailabilityRequest model + = BinaryData.fromString("{\"name\":\"hsgcbacphejkot\",\"type\":\"qgoulznd\"}") + .toObject(CheckNameAvailabilityRequest.class); + Assertions.assertEquals("hsgcbacphejkot", model.name()); + Assertions.assertEquals("qgoulznd", 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("hsgcbacphejkot").withType("qgoulznd"); model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("jaeq", model.name()); - Assertions.assertEquals("qjbasvms", model.type()); + Assertions.assertEquals("hsgcbacphejkot", model.name()); + Assertions.assertEquals("qgoulznd", 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..2ddc63d07fb88 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); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, model.reason()); - Assertions.assertEquals("gsntnbybkzgcwr", model.message()); + CheckNameAvailabilityResponseInner model + = BinaryData.fromString("{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"kgfg\"}") + .toObject(CheckNameAvailabilityResponseInner.class); + Assertions.assertEquals(false, model.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, model.reason()); + Assertions.assertEquals("kgfg", model.message()); } } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ComputePropertiesTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ComputePropertiesTests.java new file mode 100644 index 0000000000000..6a9e96044ad4c --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ComputePropertiesTests.java @@ -0,0 +1,24 @@ +// 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.ComputeProperties; +import org.junit.jupiter.api.Assertions; + +public final class ComputePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ComputeProperties model = BinaryData.fromString("{\"tier\":\"qnjaqwix\"}").toObject(ComputeProperties.class); + Assertions.assertEquals("qnjaqwix", model.tier()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ComputeProperties model = new ComputeProperties().withTier("qnjaqwix"); + model = BinaryData.fromObject(model).toObject(ComputeProperties.class); + Assertions.assertEquals("qnjaqwix", model.tier()); + } +} 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..c0d2137a662aa 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 @@ -10,8 +10,8 @@ public final class ConnectionStringTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ConnectionString model - = BinaryData.fromString("{\"connectionString\":\"xgispemvtzfkufu\",\"description\":\"jofxqe\"}") - .toObject(ConnectionString.class); + ConnectionString model = BinaryData + .fromString("{\"connectionString\":\"jfkgiawxk\",\"description\":\"ypl\",\"name\":\"kbasyypn\"}") + .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..d25f19427fbf7 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\":\"Updating\",\"startIpAddress\":\"keqsrxybzqqedq\",\"endIpAddress\":\"tbciqfouflmm\"},\"id\":\"zsm\",\"name\":\"dmgloug\",\"type\":\"b\"}") .toObject(FirewallRuleInner.class); - Assertions.assertEquals("xwrljdouskcqvkoc", model.properties().startIpAddress()); - Assertions.assertEquals("cjdkwtnhxbnjbi", model.properties().endIpAddress()); + Assertions.assertEquals("keqsrxybzqqedq", model.properties().startIpAddress()); + Assertions.assertEquals("tbciqfouflmm", model.properties().endIpAddress()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { FirewallRuleInner model = new FirewallRuleInner().withProperties( - new FirewallRuleProperties().withStartIpAddress("xwrljdouskcqvkoc").withEndIpAddress("cjdkwtnhxbnjbi")); + new FirewallRuleProperties().withStartIpAddress("keqsrxybzqqedq").withEndIpAddress("tbciqfouflmm")); model = BinaryData.fromObject(model).toObject(FirewallRuleInner.class); - Assertions.assertEquals("xwrljdouskcqvkoc", model.properties().startIpAddress()); - Assertions.assertEquals("cjdkwtnhxbnjbi", model.properties().endIpAddress()); + Assertions.assertEquals("keqsrxybzqqedq", model.properties().startIpAddress()); + Assertions.assertEquals("tbciqfouflmm", 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..123c76378bf03 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\":\"Canceled\",\"startIpAddress\":\"kdosvqw\",\"endIpAddress\":\"bmdg\"},\"id\":\"jfddgmbmbe\",\"name\":\"ppbhtqqrolfp\",\"type\":\"psalgbqux\"},{\"properties\":{\"provisioningState\":\"Failed\",\"startIpAddress\":\"jgzjaoyfhrtx\",\"endIpAddress\":\"lnerkujysvleju\"},\"id\":\"qawrlyxwj\",\"name\":\"cpr\",\"type\":\"nwbxgjvtbvpyssz\"},{\"properties\":{\"provisioningState\":\"Failed\",\"startIpAddress\":\"jq\",\"endIpAddress\":\"uhmuouqfprwzwbn\"},\"id\":\"itnwuizgazxufi\",\"name\":\"uckyf\",\"type\":\"hr\"}],\"nextLink\":\"dfvzwdzuhty\"}") .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("kdosvqw", model.value().get(0).properties().startIpAddress()); + Assertions.assertEquals("bmdg", model.value().get(0).properties().endIpAddress()); + Assertions.assertEquals("dfvzwdzuhty", 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..5ea379f172d5c 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 @@ -12,17 +12,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\"}") + .fromString( + "{\"provisioningState\":\"Updating\",\"startIpAddress\":\"mutduqktaps\",\"endIpAddress\":\"wgcu\"}") .toObject(FirewallRuleProperties.class); - Assertions.assertEquals("duuji", model.startIpAddress()); - Assertions.assertEquals("c", model.endIpAddress()); + Assertions.assertEquals("mutduqktaps", model.startIpAddress()); + Assertions.assertEquals("wgcu", 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("mutduqktaps").withEndIpAddress("wgcu"); model = BinaryData.fromObject(model).toObject(FirewallRuleProperties.class); - Assertions.assertEquals("duuji", model.startIpAddress()); - Assertions.assertEquals("c", model.endIpAddress()); + Assertions.assertEquals("mutduqktaps", model.startIpAddress()); + Assertions.assertEquals("wgcu", 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..6e4fea9e8c797 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\":\"dnfyhxdeoejzicwi\",\"endIpAddress\":\"sjttgzfbish\"},\"id\":\"khaj\",\"name\":\"eyeam\",\"type\":\"p\"}"; 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("oenkouknvudwti") + .withExistingMongoCluster("gigr", "wburvjxxjnspydpt") + .withProperties(new FirewallRuleProperties().withStartIpAddress("dng").withEndIpAddress("pocipazyxoegu")) .create(); - Assertions.assertEquals("auu", response.properties().startIpAddress()); - Assertions.assertEquals("mjmvxieduugidyjr", response.properties().endIpAddress()); + Assertions.assertEquals("dnfyhxdeoejzicwi", response.properties().startIpAddress()); + Assertions.assertEquals("sjttgzfbish", 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..a84e09f0e4011 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\":\"InProgress\",\"startIpAddress\":\"bpxjmfl\",\"endIpAddress\":\"vvnchrkcc\"},\"id\":\"wzjuqk\",\"name\":\"rsa\",\"type\":\"iwkuofos\"}"; 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("ulexxbczwtr", "wiqzbqjvsovmyo", "acspkwl", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("cma", response.properties().startIpAddress()); - Assertions.assertEquals("u", response.properties().endIpAddress()); + Assertions.assertEquals("bpxjmfl", response.properties().startIpAddress()); + Assertions.assertEquals("vvnchrkcc", 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..b755305e634d8 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\":\"Canceled\",\"startIpAddress\":\"osvexcsonpclhoc\",\"endIpAddress\":\"hslkevleggzf\"},\"id\":\"hfmvfaxkffe\",\"name\":\"ithlvmezyvshxm\",\"type\":\"sbbzo\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -31,10 +31,10 @@ public void testListByMongoCluster() throws Exception { .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - PagedIterable response - = manager.firewallRules().listByMongoCluster("twhrdxwzywqsm", "surex", com.azure.core.util.Context.NONE); + PagedIterable response = manager.firewallRules() + .listByMongoCluster("ghsauuimjmvxied", "ugidyjrr", com.azure.core.util.Context.NONE); - Assertions.assertEquals("yocf", response.iterator().next().properties().startIpAddress()); - Assertions.assertEquals("fksymddystki", response.iterator().next().properties().endIpAddress()); + Assertions.assertEquals("osvexcsonpclhoc", response.iterator().next().properties().startIpAddress()); + Assertions.assertEquals("hslkevleggzf", response.iterator().next().properties().endIpAddress()); } } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/HighAvailabilityPropertiesTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/HighAvailabilityPropertiesTests.java new file mode 100644 index 0000000000000..ba578e797ed61 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/HighAvailabilityPropertiesTests.java @@ -0,0 +1,27 @@ +// 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.HighAvailabilityMode; +import com.azure.resourcemanager.mongocluster.models.HighAvailabilityProperties; +import org.junit.jupiter.api.Assertions; + +public final class HighAvailabilityPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HighAvailabilityProperties model = BinaryData.fromString("{\"targetMode\":\"ZoneRedundantPreferred\"}") + .toObject(HighAvailabilityProperties.class); + Assertions.assertEquals(HighAvailabilityMode.ZONE_REDUNDANT_PREFERRED, model.targetMode()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HighAvailabilityProperties model + = new HighAvailabilityProperties().withTargetMode(HighAvailabilityMode.ZONE_REDUNDANT_PREFERRED); + model = BinaryData.fromObject(model).toObject(HighAvailabilityProperties.class); + Assertions.assertEquals(HighAvailabilityMode.ZONE_REDUNDANT_PREFERRED, model.targetMode()); + } +} 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..de38e58fb7524 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\":\"qduujitcjczdz\",\"description\":\"ndhkrw\",\"name\":\"appd\"},{\"connectionString\":\"dkvwrwjfe\",\"description\":\"nhutjeltmrldhugj\",\"name\":\"datqxhocdgeabl\"},{\"connectionString\":\"huticndvkao\",\"description\":\"yiftyhxhuro\",\"name\":\"tyxolniwpwc\"}]}") .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..75232ce9f2c1e --- /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\":\"napczwlokjy\",\"sourceLocation\":\"mkkvnip\"}") + .toObject(MongoClusterReplicaParameters.class); + Assertions.assertEquals("napczwlokjy", model.sourceResourceId()); + Assertions.assertEquals("mkkvnip", model.sourceLocation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoClusterReplicaParameters model + = new MongoClusterReplicaParameters().withSourceResourceId("napczwlokjy").withSourceLocation("mkkvnip"); + model = BinaryData.fromObject(model).toObject(MongoClusterReplicaParameters.class); + Assertions.assertEquals("napczwlokjy", model.sourceResourceId()); + Assertions.assertEquals("mkkvnip", 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..0829fe6baf59d 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 @@ -12,20 +12,20 @@ public final class MongoClusterRestoreParametersTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - MongoClusterRestoreParameters model - = BinaryData.fromString("{\"pointInTimeUTC\":\"2021-07-26T12:53:27Z\",\"sourceResourceId\":\"n\"}") - .toObject(MongoClusterRestoreParameters.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-26T12:53:27Z"), model.pointInTimeUTC()); - Assertions.assertEquals("n", model.sourceResourceId()); + MongoClusterRestoreParameters model = BinaryData + .fromString("{\"pointInTimeUTC\":\"2021-05-03T09:30:55Z\",\"sourceResourceId\":\"snhsjcnyejhkryh\"}") + .toObject(MongoClusterRestoreParameters.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T09:30:55Z"), model.pointInTimeUTC()); + Assertions.assertEquals("snhsjcnyejhkryh", 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-05-03T09:30:55Z")) + .withSourceResourceId("snhsjcnyejhkryh"); 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-05-03T09:30:55Z"), model.pointInTimeUTC()); + Assertions.assertEquals("snhsjcnyejhkryh", 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..2b92f58a6e4c8 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\":\"wqsmbsur\"}"; 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("uiuaodsfcpkvxodp", + new CheckNameAvailabilityRequest().withName("zmyzydagf").withType("xbezyiuokktwh"), 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("wqsmbsur", 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..931ec0d10aba7 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\":\"hbkuofqwey\",\"description\":\"menevfyexfwh\",\"name\":\"cibvyvdcsitynn\"},{\"connectionString\":\"mdectehfiqscjey\",\"description\":\"hezrkgq\",\"name\":\"jrefovgmkqsle\"},{\"connectionString\":\"vxyqjpkcattpngjc\",\"description\":\"czsqpjhvm\",\"name\":\"jvnysounqe\"},{\"connectionString\":\"noae\",\"description\":\"fhyhltrpmopjmcma\",\"name\":\"okth\"}]}"; 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("owgujjugwdkcglhs", "azjdyggd", com.azure.core.util.Context.NONE) .getValue(); } diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/NodeGroupSpecTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/NodeGroupSpecTests.java deleted file mode 100644 index 8fe5cfa865f54..0000000000000 --- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/NodeGroupSpecTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.mongocluster.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.mongocluster.models.NodeGroupSpec; -import com.azure.resourcemanager.mongocluster.models.NodeKind; -import org.junit.jupiter.api.Assertions; - -public final class NodeGroupSpecTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NodeGroupSpec model = BinaryData.fromString( - "{\"sku\":\"b\",\"diskSizeGB\":7532718659837556043,\"enableHa\":false,\"kind\":\"Shard\",\"nodeCount\":920256064}") - .toObject(NodeGroupSpec.class); - Assertions.assertEquals("b", model.sku()); - Assertions.assertEquals(7532718659837556043L, model.diskSizeGB()); - Assertions.assertEquals(false, model.enableHa()); - Assertions.assertEquals(NodeKind.SHARD, model.kind()); - Assertions.assertEquals(920256064, model.nodeCount()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NodeGroupSpec model = new NodeGroupSpec().withSku("b") - .withDiskSizeGB(7532718659837556043L) - .withEnableHa(false) - .withKind(NodeKind.SHARD) - .withNodeCount(920256064); - model = BinaryData.fromObject(model).toObject(NodeGroupSpec.class); - Assertions.assertEquals("b", model.sku()); - Assertions.assertEquals(7532718659837556043L, model.diskSizeGB()); - Assertions.assertEquals(false, model.enableHa()); - Assertions.assertEquals(NodeKind.SHARD, model.kind()); - Assertions.assertEquals(920256064, model.nodeCount()); - } -} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationDisplayTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/OperationDisplayTests.java 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..6d424a75211f0 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\":\"ecfvmm\",\"isDataAction\":false,\"display\":{\"provider\":\"xlzevgbmqjqabcy\",\"resource\":\"ivkwlzuvccfwnfnb\",\"operation\":\"fionl\",\"description\":\"x\"},\"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..02c1c79ef2888 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\":[\"inzgvfcj\"],\"privateEndpoint\":{\"id\":\"oxxjtfelluwf\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"np\",\"actionsRequired\":\"fpjkjlxofp\"},\"provisioningState\":\"Succeeded\"}") .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("np", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("fpjkjlxofp", 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("np") + .withActionsRequired("fpjkjlxofp")); 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("np", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("fpjkjlxofp", 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..c112f8f3b62fa 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\":[\"bl\"],\"privateEndpoint\":{\"id\":\"pbtoqcjmkl\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"qidtqajzyu\",\"actionsRequired\":\"kudjkrlkhb\"},\"provisioningState\":\"Creating\"},\"id\":\"pgzgq\",\"name\":\"xzlocxscp\",\"type\":\"ierhhbcsglummaj\"}") .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("qidtqajzyu", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("kudjkrlkhb", 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("qidtqajzyu") + .withActionsRequired("kudjkrlkhb"))); 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("qidtqajzyu", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("kudjkrlkhb", 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..2fc7a869d33c3 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\":[\"kfthwxmntei\",\"aop\",\"km\"],\"privateEndpoint\":{\"id\":\"mmxdcu\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"rpymzidnsez\",\"actionsRequired\":\"tbzsgfyccs\"},\"provisioningState\":\"Failed\"},\"id\":\"dwzjeiach\",\"name\":\"oosflnr\",\"type\":\"sfqpteehz\"},{\"properties\":{\"groupIds\":[\"yqrimzin\"],\"privateEndpoint\":{\"id\":\"wjdk\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"od\",\"actionsRequired\":\"hc\"},\"provisioningState\":\"Creating\"},\"id\":\"hjtckwhd\",\"name\":\"oifiyipjxsqwpgr\",\"type\":\"bznorcjxvsnby\"}],\"nextLink\":\"abnmocpcyshu\"}") .toObject(PrivateEndpointConnectionResourceListResult.class); Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, model.value().get(0).properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("modmglougpb", + Assertions.assertEquals("rpymzidnsez", model.value().get(0).properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("tmut", + Assertions.assertEquals("tbzsgfyccs", model.value().get(0).properties().privateLinkServiceConnectionState().actionsRequired()); - Assertions.assertEquals("tymw", model.nextLink()); + Assertions.assertEquals("abnmocpcyshu", 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..a702fbb1f9324 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,12 @@ 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\":[\"cmdv\",\"jhulsuuvmkjo\",\"k\",\"wfndiodjpsl\"],\"privateEndpoint\":{\"id\":\"dpvwryoqpsoaccta\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"j\",\"actionsRequired\":\"hbcryffdfdosyge\"},\"provisioningState\":\"Failed\"},\"id\":\"jakhmsbzjh\",\"name\":\"rzevdphlxaol\",\"type\":\"hqtrgqjbpf\"}") .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("j", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("hbcryffdfdosyge", 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..f80e86ade435f 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\":[\"nuqqkpikadrgvt\",\"agnb\",\"ynhijggme\"],\"privateEndpoint\":{\"id\":\"iarbutrcvpna\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"jrunmpxtt\",\"actionsRequired\":\"hrbnlankxmyskpbh\"},\"provisioningState\":\"Succeeded\"},\"id\":\"kcxywnyt\",\"name\":\"rsyn\",\"type\":\"qidybyx\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -36,19 +36,19 @@ public void testCreate() throws Exception { PrivateEndpointConnectionResource response = manager.privateEndpointConnections() - .define("bin") - .withExistingMongoCluster("wkgshwa", "kix") + .define("ljyoxgvcltb") + .withExistingMongoCluster("jky", "xjvuujqgidokg") .withProperties(new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) - .withDescription("gyxzk") - .withActionsRequired("ocukoklyax"))) + .withDescription("ec") + .withActionsRequired("odebfqkkrbmpu"))) .create(); Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("fuwutttxf", response.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("rbirphxe", + Assertions.assertEquals("jrunmpxtt", response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("hrbnlankxmyskpbh", 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..adb45eff8c8f2 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\":[\"pwvlqdq\"],\"privateEndpoint\":{\"id\":\"qylihkaetckt\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"vf\",\"actionsRequired\":\"kymuctqhjfbebr\"},\"provisioningState\":\"Succeeded\"},\"id\":\"rfuwutt\",\"name\":\"xfvjrbirp\",\"type\":\"xepcyvahfn\"}"; 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("uconuqszfkbey", "ewrmjmwvvjektc", "senhwlrs", com.azure.core.util.Context.NONE) .getValue(); Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("fsj", response.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("gzfbishcbk", + Assertions.assertEquals("vf", response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("kymuctqhjfbebr", 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..3e18244ca20ea 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\":[\"zbinjeputtm\",\"ywnuzoq\",\"tiyqzrnkcqv\"],\"privateEndpoint\":{\"id\":\"whzlsicohoq\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"lryav\",\"actionsRequired\":\"heun\"},\"provisioningState\":\"Failed\"},\"id\":\"gyxzk\",\"name\":\"noc\",\"type\":\"koklya\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -33,13 +33,13 @@ public void testListByMongoCluster() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = manager.privateEndpointConnections() - .listByMongoCluster("onpc", "hocohslkev", com.azure.core.util.Context.NONE); + .listByMongoCluster("agalpbuxwgipwhon", "wkgshwa", com.azure.core.util.Context.NONE); Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, response.iterator().next().properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("vmezy", + Assertions.assertEquals("lryav", response.iterator().next().properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("hxmzsbbzoggig", + Assertions.assertEquals("heun", 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..7c0105dd64832 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\":\"fxxypininmayhuy\"}").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..e09b918d5d059 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\":\"exhd\",\"requiredMembers\":[\"bqe\"],\"requiredZoneNames\":[\"xqbzvddntwnd\",\"icbtwnpzao\",\"vuhrhcffcyddgl\"]},\"id\":\"t\",\"name\":\"jqkwpyeicx\",\"type\":\"qciwqvhkhixuigdt\"}") .toObject(PrivateLinkResourceInner.class); - Assertions.assertEquals("efgugnxk", model.properties().requiredZoneNames().get(0)); + Assertions.assertEquals("xqbzvddntwnd", 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..43d54ec620449 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\":\"dxob\",\"requiredMembers\":[\"xkqpxo\",\"ajionpimexgstxg\"],\"requiredZoneNames\":[\"dg\",\"aajrm\",\"djwzrlov\",\"clwhijcoejctbz\"]},\"id\":\"s\",\"name\":\"sycbkbfk\",\"type\":\"ukdkexxppofmxa\"}],\"nextLink\":\"fjpgddtocjjxhvp\"}") .toObject(PrivateLinkResourceListResult.class); - Assertions.assertEquals("wpgrjbzno", model.value().get(0).properties().requiredZoneNames().get(0)); - Assertions.assertEquals("khixuigdtopbo", model.nextLink()); + Assertions.assertEquals("dg", model.value().get(0).properties().requiredZoneNames().get(0)); + Assertions.assertEquals("fjpgddtocjjxhvp", 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..9c907cd9aeb6e 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 @@ -11,9 +11,9 @@ 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\"]}") + PrivateLinkResourceProperties model = BinaryData + .fromString("{\"groupId\":\"bob\",\"requiredMembers\":[\"hm\",\"w\"],\"requiredZoneNames\":[\"a\"]}") .toObject(PrivateLinkResourceProperties.class); - Assertions.assertEquals("lzu", model.requiredZoneNames().get(0)); + Assertions.assertEquals("a", 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..f7380066e61dc 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,22 @@ 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\":\"Approved\",\"description\":\"odepoogin\",\"actionsRequired\":\"amiheognarxz\"}") .toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, model.status()); - Assertions.assertEquals("cr", model.description()); - Assertions.assertEquals("fdfdosygexpa", model.actionsRequired()); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, model.status()); + Assertions.assertEquals("odepoogin", model.description()); + Assertions.assertEquals("amiheognarxz", 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.APPROVED) + .withDescription("odepoogin") + .withActionsRequired("amiheognarxz"); 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.APPROVED, model.status()); + Assertions.assertEquals("odepoogin", model.description()); + Assertions.assertEquals("amiheognarxz", 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..f28dfbe7bb926 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\":\"tsthsucocm\",\"requiredMembers\":[\"azt\",\"bt\",\"wrqpue\",\"ckzywbiexzfeyue\"],\"requiredZoneNames\":[\"bxu\"]},\"id\":\"bhqwalmuzyoxa\",\"name\":\"pdkzjancuxr\",\"type\":\"d\"}]}"; 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("zfcl", "aaxdbabphlwrq", com.azure.core.util.Context.NONE); - Assertions.assertEquals("ahmgkbrp", response.iterator().next().properties().requiredZoneNames().get(0)); + Assertions.assertEquals("bxu", 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..30db951954b59 --- /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\":\"heotusiv\",\"role\":\"Primary\",\"replicationState\":\"Provisioning\"}") + .toObject(ReplicationProperties.class); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ShardingPropertiesTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ShardingPropertiesTests.java new file mode 100644 index 0000000000000..7e11a99030200 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/ShardingPropertiesTests.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; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.mongocluster.models.ShardingProperties; +import org.junit.jupiter.api.Assertions; + +public final class ShardingPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ShardingProperties model + = BinaryData.fromString("{\"shardCount\":1511051439}").toObject(ShardingProperties.class); + Assertions.assertEquals(1511051439, model.shardCount()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ShardingProperties model = new ShardingProperties().withShardCount(1511051439); + model = BinaryData.fromObject(model).toObject(ShardingProperties.class); + Assertions.assertEquals(1511051439, model.shardCount()); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/StoragePropertiesTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/StoragePropertiesTests.java new file mode 100644 index 0000000000000..f4901359a38b5 --- /dev/null +++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/generated/StoragePropertiesTests.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; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.mongocluster.models.StorageProperties; +import org.junit.jupiter.api.Assertions; + +public final class StoragePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageProperties model + = BinaryData.fromString("{\"sizeGb\":2292906968066822359}").toObject(StorageProperties.class); + Assertions.assertEquals(2292906968066822359L, model.sizeGb()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageProperties model = new StorageProperties().withSizeGb(2292906968066822359L); + model = BinaryData.fromObject(model).toObject(StorageProperties.class); + Assertions.assertEquals(2292906968066822359L, model.sizeGb()); + } +} diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/tsp-location.yaml b/sdk/mongocluster/azure-resourcemanager-mongocluster/tsp-location.yaml index 15039ca457d05..c720d11a50ab8 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 +commit: a060bc2360831f539b81d2d9b4e9db13caec8a9f +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: