diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md index 14a7d0544607e..4cb7362527ce5 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.7 (Unreleased) +## 1.0.0-beta.1 (2023-05-23) + +- Azure Resource Manager PostgreSql client library for Java. This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2023-03-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md index f78faf946b6d1..89eced7a579f8 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md @@ -2,7 +2,7 @@ Azure Resource Manager PostgreSql client library for Java. -This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2022-12-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2023-03-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-postgresqlflexibleserver - 1.0.0-beta.6 + 1.0.0-beta.7 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/SAMPLE.md b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/SAMPLE.md index 0456cfae25d9a..c944d8719b3dd 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/SAMPLE.md +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/SAMPLE.md @@ -42,6 +42,11 @@ - [Get](#firewallrules_get) - [ListByServer](#firewallrules_listbyserver) +## FlexibleServer + +- [StartLtrBackup](#flexibleserver_startltrbackup) +- [TriggerLtrPreBackup](#flexibleserver_triggerltrprebackup) + ## GetPrivateDnsZoneSuffix - [Execute](#getprivatednszonesuffix_execute) @@ -50,6 +55,23 @@ - [Execute](#locationbasedcapabilities_execute) +## LogFiles + +- [ListByServer](#logfiles_listbyserver) + +## LtrBackupOperations + +- [Get](#ltrbackupoperations_get) +- [ListByServer](#ltrbackupoperations_listbyserver) + +## Migrations + +- [Create](#migrations_create) +- [Delete](#migrations_delete) +- [Get](#migrations_get) +- [ListByTargetServer](#migrations_listbytargetserver) +- [Update](#migrations_update) + ## Operations - [List](#operations_list) @@ -58,6 +80,14 @@ - [ListByServer](#replicas_listbyserver) +## ResourceProvider + +- [CheckMigrationNameAvailability](#resourceprovider_checkmigrationnameavailability) + +## ServerCapabilities + +- [List](#servercapabilities_list) + ## Servers - [Create](#servers_create) @@ -81,7 +111,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.PrincipalType; /** Samples for Administrators Create. */ public final class AdministratorsCreateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/AdministratorAdd.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorAdd.json */ /** * Sample code: Adds an Active DIrectory Administrator for the server. @@ -108,7 +138,7 @@ public final class AdministratorsCreateSamples { /** Samples for Administrators Delete. */ public final class AdministratorsDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/AdministratorDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorDelete.json */ /** * Sample code: AdministratorDelete. @@ -130,7 +160,7 @@ public final class AdministratorsDeleteSamples { /** Samples for Administrators Get. */ public final class AdministratorsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/AdministratorGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorGet.json */ /** * Sample code: ServerGet. @@ -152,7 +182,7 @@ public final class AdministratorsGetSamples { /** Samples for Administrators ListByServer. */ public final class AdministratorsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/AdministratorsListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorsListByServer.json */ /** * Sample code: AdministratorsListByServer. @@ -172,7 +202,7 @@ public final class AdministratorsListByServerSamples { /** Samples for Backups Get. */ public final class BackupsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/BackupGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupGet.json */ /** * Sample code: Get a backup for a server. @@ -195,7 +225,7 @@ public final class BackupsGetSamples { /** Samples for Backups ListByServer. */ public final class BackupsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/BackupListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupListByServer.json */ /** * Sample code: List backups for a server. @@ -217,7 +247,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvaila /** Samples for CheckNameAvailability Execute. */ public final class CheckNameAvailabilityExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/CheckNameAvailability.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckNameAvailability.json */ /** * Sample code: NameAvailability. @@ -244,7 +274,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvaila /** Samples for CheckNameAvailabilityWithLocation Execute. */ public final class CheckNameAvailabilityWithLocationExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/CheckNameAvailabilityLocationBased.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckNameAvailabilityLocationBased.json */ /** * Sample code: NameAvailability. @@ -270,7 +300,7 @@ public final class CheckNameAvailabilityWithLocationExecuteSamples { /** Samples for Configurations Get. */ public final class ConfigurationsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ConfigurationGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationGet.json */ /** * Sample code: ConfigurationGet. @@ -291,7 +321,7 @@ public final class ConfigurationsGetSamples { /** Samples for Configurations ListByServer. */ public final class ConfigurationsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ConfigurationListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationListByServer.json */ /** * Sample code: ConfigurationList. @@ -310,7 +340,7 @@ public final class ConfigurationsListByServerSamples { /** Samples for Configurations Put. */ public final class ConfigurationsPutSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ConfigurationUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationUpdate.json */ /** * Sample code: Update a user configuration. @@ -338,7 +368,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; /** Samples for Configurations Update. */ public final class ConfigurationsUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ConfigurationUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationUpdate.json */ /** * Sample code: Update a user configuration. @@ -363,7 +393,7 @@ public final class ConfigurationsUpdateSamples { /** Samples for Databases Create. */ public final class DatabasesCreateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabaseCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseCreate.json */ /** * Sample code: Create a database. @@ -388,7 +418,7 @@ public final class DatabasesCreateSamples { /** Samples for Databases Delete. */ public final class DatabasesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabaseDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseDelete.json */ /** * Sample code: Delete a database. @@ -407,7 +437,7 @@ public final class DatabasesDeleteSamples { /** Samples for Databases Get. */ public final class DatabasesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabaseGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseGet.json */ /** * Sample code: Get a database. @@ -426,7 +456,7 @@ public final class DatabasesGetSamples { /** Samples for Databases ListByServer. */ public final class DatabasesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabasesListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabasesListByServer.json */ /** * Sample code: List databases in a server. @@ -446,7 +476,7 @@ public final class DatabasesListByServerSamples { /** Samples for FirewallRules CreateOrUpdate. */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/FirewallRuleCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleCreate.json */ /** * Sample code: FirewallRuleCreate. @@ -472,7 +502,7 @@ public final class FirewallRulesCreateOrUpdateSamples { /** Samples for FirewallRules Delete. */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/FirewallRuleDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleDelete.json */ /** * Sample code: FirewallRuleDelete. @@ -492,7 +522,7 @@ public final class FirewallRulesDeleteSamples { /** Samples for FirewallRules Get. */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/FirewallRuleGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleGet.json */ /** * Sample code: FirewallRuleList. @@ -511,7 +541,7 @@ public final class FirewallRulesGetSamples { /** Samples for FirewallRules ListByServer. */ public final class FirewallRulesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/FirewallRuleListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleListByServer.json */ /** * Sample code: FirewallRuleList. @@ -524,13 +554,74 @@ public final class FirewallRulesListByServerSamples { } ``` +### FlexibleServer_StartLtrBackup + +```java +import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupSettings; +import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupStoreDetails; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrBackupRequest; +import java.util.Arrays; + +/** Samples for FlexibleServer StartLtrBackup. */ +public final class FlexibleServerStartLtrBackupSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionBackup.json + */ + /** + * Sample code: Sample_ExecuteBackup. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void sampleExecuteBackup( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .flexibleServers() + .startLtrBackup( + "rgLongTermRetention", + "pgsqlltrtestserver", + new LtrBackupRequest() + .withBackupSettings(new BackupSettings().withBackupName("backup1")) + .withTargetDetails(new BackupStoreDetails().withSasUriList(Arrays.asList("sasuri"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### FlexibleServer_TriggerLtrPreBackup + +```java +import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupSettings; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrPreBackupRequest; + +/** Samples for FlexibleServer TriggerLtrPreBackup. */ +public final class FlexibleServerTriggerLtrPreBackupSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionPreBackup.json + */ + /** + * Sample code: Sample_Prebackup. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void samplePrebackup(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .flexibleServers() + .triggerLtrPreBackupWithResponse( + "rgLongTermRetention", + "pgsqlltrtestserver", + new LtrPreBackupRequest().withBackupSettings(new BackupSettings().withBackupName("backup1")), + com.azure.core.util.Context.NONE); + } +} +``` + ### GetPrivateDnsZoneSuffix_Execute ```java /** Samples for GetPrivateDnsZoneSuffix Execute. */ public final class GetPrivateDnsZoneSuffixExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/GetPrivateDnsZoneSuffix.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/GetPrivateDnsZoneSuffix.json */ /** * Sample code: GetPrivateDnsZoneSuffix. @@ -550,7 +641,7 @@ public final class GetPrivateDnsZoneSuffixExecuteSamples { /** Samples for LocationBasedCapabilities Execute. */ public final class LocationBasedCapabilitiesExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/CapabilitiesByLocation.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CapabilitiesByLocation.json */ /** * Sample code: CapabilitiesList. @@ -563,13 +654,283 @@ public final class LocationBasedCapabilitiesExecuteSamples { } ``` +### LogFiles_ListByServer + +```java +/** Samples for LogFiles ListByServer. */ +public final class LogFilesListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LogFilesListByServer.json + */ + /** + * Sample code: List all server log files for a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listAllServerLogFilesForAServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.logFiles().listByServer("testrg", "postgresqltestsvc1", com.azure.core.util.Context.NONE); + } +} +``` + +### LtrBackupOperations_Get + +```java +/** Samples for LtrBackupOperations Get. */ +public final class LtrBackupOperationsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationGet.json + */ + /** + * Sample code: Sample. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void sample(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .ltrBackupOperations() + .getWithResponse("rgLongTermRetention", "pgsqlltrtestserver", "backup1", com.azure.core.util.Context.NONE); + } +} +``` + +### LtrBackupOperations_ListByServer + +```java +/** Samples for LtrBackupOperations ListByServer. */ +public final class LtrBackupOperationsListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationListByServer.json + */ + /** + * Sample code: Sample List of Long Tern Retention Operations by Flexible Server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void sampleListOfLongTernRetentionOperationsByFlexibleServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .ltrBackupOperations() + .listByServer("rgLongTermRetention", "pgsqlltrtestserver", com.azure.core.util.Context.NONE); + } +} +``` + +### Migrations_Create + +```java +import com.azure.resourcemanager.postgresqlflexibleserver.models.AdminCredentials; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationMode; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationSecretParameters; +import com.azure.resourcemanager.postgresqlflexibleserver.models.OverwriteDbsInTargetEnum; +import java.util.Arrays; + +/** Samples for Migrations Create. */ +public final class MigrationsCreateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Create_With_Other_Users.json + */ + /** + * Sample code: Migrations Create by passing user names. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsCreateByPassingUserNames( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .define("testmigration") + .withRegion("westus") + .withExistingFlexibleServer("ffffffff-ffff-ffff-ffff-ffffffffffff", "testrg", "testtarget") + .withMigrationMode(MigrationMode.OFFLINE) + .withSourceDbServerResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource") + .withSecretParameters( + new MigrationSecretParameters() + .withAdminCredentials( + new AdminCredentials() + .withSourceServerPassword("fakeTokenPlaceholder") + .withTargetServerPassword("fakeTokenPlaceholder")) + .withSourceServerUsername("newadmin@testsource") + .withTargetServerUsername("targetadmin")) + .withDbsToMigrate(Arrays.asList("db1", "db2", "db3", "db4")) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Create.json + */ + /** + * Sample code: Migrations_Create. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsCreate(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .define("testmigration") + .withRegion("westus") + .withExistingFlexibleServer("ffffffff-ffff-ffff-ffff-ffffffffffff", "testrg", "testtarget") + .withMigrationMode(MigrationMode.OFFLINE) + .withSourceDbServerResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource") + .withSecretParameters( + new MigrationSecretParameters() + .withAdminCredentials( + new AdminCredentials() + .withSourceServerPassword("fakeTokenPlaceholder") + .withTargetServerPassword("fakeTokenPlaceholder"))) + .withDbsToMigrate(Arrays.asList("db1", "db2", "db3", "db4")) + .withOverwriteDbsInTarget(OverwriteDbsInTargetEnum.TRUE) + .create(); + } +} +``` + +### Migrations_Delete + +```java +/** Samples for Migrations Delete. */ +public final class MigrationsDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Delete.json + */ + /** + * Sample code: Migrations_Delete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsDelete(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .deleteWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + "testmigration", + com.azure.core.util.Context.NONE); + } +} +``` + +### Migrations_Get + +```java +/** Samples for Migrations Get. */ +public final class MigrationsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Get.json + */ + /** + * Sample code: Migrations_Get. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .getWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + "testmigration", + com.azure.core.util.Context.NONE); + } +} +``` + +### Migrations_ListByTargetServer + +```java +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationListFilter; + +/** Samples for Migrations ListByTargetServer. */ +public final class MigrationsListByTargetServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_ListByTargetServer.json + */ + /** + * Sample code: Migrations_ListByTargetServer. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsListByTargetServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .listByTargetServer( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + MigrationListFilter.ALL, + com.azure.core.util.Context.NONE); + } +} +``` + +### Migrations_Update + +```java +import com.azure.resourcemanager.postgresqlflexibleserver.models.CancelEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogicalReplicationOnSourceDbEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationResource; + +/** Samples for Migrations Update. */ +public final class MigrationsUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Cancel.json + */ + /** + * Sample code: Cancel migration. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void cancelMigration(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + MigrationResource resource = + manager + .migrations() + .getWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + "testmigration", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withCancel(CancelEnum.TRUE).apply(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Update.json + */ + /** + * Sample code: Migrations_Update. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsUpdate(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + MigrationResource resource = + manager + .migrations() + .getWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + "testmigration", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withSetupLogicalReplicationOnSourceDbIfNeeded(LogicalReplicationOnSourceDbEnum.TRUE).apply(); + } +} +``` + ### Operations_List ```java /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/OperationList.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/OperationList.json */ /** * Sample code: OperationList. @@ -588,7 +949,7 @@ public final class OperationsListSamples { /** Samples for Replicas ListByServer. */ public final class ReplicasListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ReplicasListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ReplicasListByServer.json */ /** * Sample code: ReplicasListByServer. @@ -602,12 +963,64 @@ public final class ReplicasListByServerSamples { } ``` +### ResourceProvider_CheckMigrationNameAvailability + +```java +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationNameAvailabilityResourceInner; + +/** Samples for ResourceProvider CheckMigrationNameAvailability. */ +public final class ResourceProviderCheckMigrationNameAvailabilitySamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckMigrationNameAvailability.json + */ + /** + * Sample code: CheckMigrationNameAvailability. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void checkMigrationNameAvailability( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .resourceProviders() + .checkMigrationNameAvailabilityWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + new MigrationNameAvailabilityResourceInner() + .withName("name1") + .withType("Microsoft.DBforPostgreSQL/flexibleServers/migrations"), + com.azure.core.util.Context.NONE); + } +} +``` + +### ServerCapabilities_List + +```java +/** Samples for ServerCapabilities List. */ +public final class ServerCapabilitiesListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCapabilities.json + */ + /** + * Sample code: ServerCapabilitiesList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverCapabilitiesList( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverCapabilities().list("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); + } +} +``` + ### Servers_Create ```java import com.azure.resourcemanager.postgresqlflexibleserver.models.ActiveDirectoryAuthEnum; import com.azure.resourcemanager.postgresqlflexibleserver.models.ArmServerKeyType; import com.azure.resourcemanager.postgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTiers; import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode; import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption; @@ -621,6 +1034,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow; import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity; import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity; import java.time.OffsetDateTime; @@ -630,7 +1044,7 @@ import java.util.Map; /** Samples for Servers Create. */ public final class ServersCreateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithDataEncryptionEnabled.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateWithDataEncryptionEnabled.json */ /** * Sample code: ServerCreateWithDataEncryptionEnabled. @@ -656,12 +1070,14 @@ public final class ServersCreateSamples { .withAdministratorLogin("cloudsa") .withAdministratorLoginPassword("password") .withVersion(ServerVersion.ONE_TWO) - .withStorage(new Storage().withStorageSizeGB(512)) + .withStorage(new Storage().withStorageSizeGB(512).withAutoGrow(StorageAutoGrow.DISABLED)) .withDataEncryption( new DataEncryption() .withPrimaryKeyUri("fakeTokenPlaceholder") .withPrimaryUserAssignedIdentityId( "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withGeoBackupKeyUri("fakeTokenPlaceholder") + .withGeoBackupUserAssignedIdentityId("") .withType(ArmServerKeyType.AZURE_KEY_VAULT)) .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED)) .withNetwork( @@ -677,7 +1093,29 @@ public final class ServersCreateSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateGeoRestore.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateReviveDropped.json + */ + /** + * Sample code: ServerCreateReviveDropped. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverCreateReviveDropped( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .servers() + .define("pgtestsvc5-rev") + .withRegion("westus") + .withExistingResourceGroup("testrg") + .withSourceServerResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5") + .withPointInTimeUtc(OffsetDateTime.parse("2023-04-27T00:04:59.4078005+00:00")) + .withCreateMode(CreateMode.REVIVE_DROPPED) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateGeoRestoreWithDataEncryptionEnabled.json */ /** * Sample code: Create a database as a geo-restore in geo-paired location. @@ -691,6 +1129,24 @@ public final class ServersCreateSamples { .define("pgtestsvc5geo") .withRegion("eastus") .withExistingResourceGroup("testrg") + .withIdentity( + new UserAssignedIdentity() + .withUserAssignedIdentities( + mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity", + new UserIdentity(), + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + new UserIdentity())) + .withType(IdentityType.USER_ASSIGNED)) + .withDataEncryption( + new DataEncryption() + .withPrimaryKeyUri("fakeTokenPlaceholder") + .withPrimaryUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withGeoBackupKeyUri("fakeTokenPlaceholder") + .withGeoBackupUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity") + .withType(ArmServerKeyType.AZURE_KEY_VAULT)) .withSourceServerResourceId( "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername") .withPointInTimeUtc(OffsetDateTime.parse("2021-06-27T00:04:59.4078005+00:00")) @@ -699,7 +1155,7 @@ public final class ServersCreateSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreate.json */ /** * Sample code: Create a new server. @@ -717,7 +1173,11 @@ public final class ServersCreateSamples { .withAdministratorLogin("cloudsa") .withAdministratorLoginPassword("password") .withVersion(ServerVersion.ONE_TWO) - .withStorage(new Storage().withStorageSizeGB(512)) + .withStorage( + new Storage() + .withStorageSizeGB(512) + .withAutoGrow(StorageAutoGrow.DISABLED) + .withIopsTier(AzureManagedDiskPerformanceTiers.P20)) .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED)) .withNetwork( new Network() @@ -732,7 +1192,7 @@ public final class ServersCreateSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithAadAuthEnabled.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateWithAadAuthEnabled.json */ /** * Sample code: Create a new server with active directory authentication enabled. @@ -751,7 +1211,11 @@ public final class ServersCreateSamples { .withAdministratorLogin("cloudsa") .withAdministratorLoginPassword("password") .withVersion(ServerVersion.ONE_TWO) - .withStorage(new Storage().withStorageSizeGB(512)) + .withStorage( + new Storage() + .withStorageSizeGB(512) + .withAutoGrow(StorageAutoGrow.DISABLED) + .withIopsTier(AzureManagedDiskPerformanceTiers.P20)) .withAuthConfig( new AuthConfig() .withActiveDirectoryAuth(ActiveDirectoryAuthEnum.ENABLED) @@ -772,7 +1236,7 @@ public final class ServersCreateSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateReplica.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateReplica.json */ /** * Sample code: ServerCreateReplica. @@ -786,6 +1250,21 @@ public final class ServersCreateSamples { .define("pgtestsvc5rep") .withRegion("westus") .withExistingResourceGroup("testrg") + .withIdentity( + new UserAssignedIdentity() + .withUserAssignedIdentities( + mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + new UserIdentity())) + .withType(IdentityType.USER_ASSIGNED)) + .withDataEncryption( + new DataEncryption() + .withPrimaryKeyUri("fakeTokenPlaceholder") + .withPrimaryUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withGeoBackupKeyUri("fakeTokenPlaceholder") + .withGeoBackupUserAssignedIdentityId("") + .withType(ArmServerKeyType.AZURE_KEY_VAULT)) .withSourceServerResourceId( "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername") .withPointInTimeUtc(OffsetDateTime.parse("2021-06-27T00:04:59.4078005+00:00")) @@ -794,7 +1273,7 @@ public final class ServersCreateSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreatePointInTimeRestore.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreatePointInTimeRestore.json */ /** * Sample code: Create a database as a point in time restore. @@ -834,7 +1313,7 @@ public final class ServersCreateSamples { /** Samples for Servers Delete. */ public final class ServersDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerDelete.json */ /** * Sample code: ServerDelete. @@ -853,7 +1332,7 @@ public final class ServersDeleteSamples { /** Samples for Servers GetByResourceGroup. */ public final class ServersGetByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGet.json */ /** * Sample code: ServerGet. @@ -865,7 +1344,7 @@ public final class ServersGetByResourceGroupSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerGetWithVnet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGetWithVnet.json */ /** * Sample code: ServerGetWithVnet. @@ -884,7 +1363,7 @@ public final class ServersGetByResourceGroupSamples { /** Samples for Servers List. */ public final class ServersListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerList.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerList.json */ /** * Sample code: ServerList. @@ -903,7 +1382,7 @@ public final class ServersListSamples { /** Samples for Servers ListByResourceGroup. */ public final class ServersListByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerListByResourceGroup.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerListByResourceGroup.json */ /** * Sample code: ServerListByResourceGroup. @@ -926,7 +1405,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParamete /** Samples for Servers Restart. */ public final class ServersRestartSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerRestart.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerRestart.json */ /** * Sample code: ServerRestart. @@ -938,7 +1417,7 @@ public final class ServersRestartSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerRestartWithFailover.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerRestartWithFailover.json */ /** * Sample code: ServerRestartWithFailover. @@ -964,7 +1443,7 @@ public final class ServersRestartSamples { /** Samples for Servers Start. */ public final class ServersStartSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerStart.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerStart.json */ /** * Sample code: ServerStart. @@ -983,7 +1462,7 @@ public final class ServersStartSamples { /** Samples for Servers Stop. */ public final class ServersStopSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerStop.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerStop.json */ /** * Sample code: ServerStop. @@ -1002,6 +1481,7 @@ public final class ServersStopSamples { import com.azure.resourcemanager.postgresqlflexibleserver.models.ActiveDirectoryAuthEnum; import com.azure.resourcemanager.postgresqlflexibleserver.models.ArmServerKeyType; import com.azure.resourcemanager.postgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTiers; import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForUpdate; import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption; @@ -1013,6 +1493,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow; import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity; import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity; import java.util.HashMap; @@ -1021,7 +1502,7 @@ import java.util.Map; /** Samples for Servers Update. */ public final class ServersUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdateWithAadAuthEnabled.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithAadAuthEnabled.json */ /** * Sample code: ServerUpdateWithAadAuthEnabled. @@ -1039,7 +1520,11 @@ public final class ServersUpdateSamples { .update() .withSku(new Sku().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE)) .withAdministratorLoginPassword("newpassword") - .withStorage(new Storage().withStorageSizeGB(1024)) + .withStorage( + new Storage() + .withStorageSizeGB(1024) + .withAutoGrow(StorageAutoGrow.DISABLED) + .withIopsTier(AzureManagedDiskPerformanceTiers.P30)) .withBackup(new Backup().withBackupRetentionDays(20)) .withAuthConfig( new AuthConfig() @@ -1051,7 +1536,7 @@ public final class ServersUpdateSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdateWithDataEncryptionEnabled.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithDataEncryptionEnabled.json */ /** * Sample code: ServerUpdateWithDataEncryptionEnabled. @@ -1072,24 +1557,28 @@ public final class ServersUpdateSamples { new UserAssignedIdentity() .withUserAssignedIdentities( mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity", + new UserIdentity(), "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", new UserIdentity())) .withType(IdentityType.USER_ASSIGNED)) .withAdministratorLoginPassword("newpassword") - .withStorage(new Storage().withStorageSizeGB(1024)) .withBackup(new Backup().withBackupRetentionDays(20)) .withDataEncryption( new DataEncryption() .withPrimaryKeyUri("fakeTokenPlaceholder") .withPrimaryUserAssignedIdentityId( "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withGeoBackupKeyUri("fakeTokenPlaceholder") + .withGeoBackupUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity") .withType(ArmServerKeyType.AZURE_KEY_VAULT)) .withCreateMode(CreateModeForUpdate.UPDATE) .apply(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdate.json */ /** * Sample code: ServerUpdate. @@ -1106,14 +1595,18 @@ public final class ServersUpdateSamples { .update() .withSku(new Sku().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE)) .withAdministratorLoginPassword("newpassword") - .withStorage(new Storage().withStorageSizeGB(1024)) + .withStorage( + new Storage() + .withStorageSizeGB(1024) + .withAutoGrow(StorageAutoGrow.ENABLED) + .withIopsTier(AzureManagedDiskPerformanceTiers.P30)) .withBackup(new Backup().withBackupRetentionDays(20)) .withCreateMode(CreateModeForUpdate.UPDATE) .apply(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdateWithMajorVersionUpgrade.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithMajorVersionUpgrade.json */ /** * Sample code: ServerUpdateWithMajorVersionUpgrade. @@ -1131,7 +1624,7 @@ public final class ServersUpdateSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdateWithCustomerMaintenanceWindow.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json */ /** * Sample code: ServerUpdateWithCustomerMaintenanceWindow. @@ -1178,7 +1671,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkS /** Samples for VirtualNetworkSubnetUsage Execute. */ public final class VirtualNetworkSubnetUsageExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/VirtualNetworkSubnetUsage.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/VirtualNetworkSubnetUsage.json */ /** * Sample code: VirtualNetworkSubnetUsageList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml index 58b010477b85d..3a9f564919fe8 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for PostgreSql Management - This package contains Microsoft Azure SDK for PostgreSql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2022-12-01. + This package contains Microsoft Azure SDK for PostgreSql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2023-03-01-preview. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java index db3138bbea50d..935403b63549e 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java @@ -31,11 +31,17 @@ import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ConfigurationsImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.DatabasesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.FlexibleServersImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.GetPrivateDnsZoneSuffixesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.LocationBasedCapabilitiesImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.LogFilesImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.LtrBackupOperationsImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.MigrationsImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.OperationsImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.PostgreSqlManagementClientBuilder; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ReplicasImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerCapabilitiesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServersImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.VirtualNetworkSubnetUsagesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.models.Administrators; @@ -45,10 +51,16 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.Configurations; import com.azure.resourcemanager.postgresqlflexibleserver.models.Databases; import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRules; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServers; import com.azure.resourcemanager.postgresqlflexibleserver.models.GetPrivateDnsZoneSuffixes; import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedCapabilities; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFiles; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrBackupOperations; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Migrations; import com.azure.resourcemanager.postgresqlflexibleserver.models.Operations; import com.azure.resourcemanager.postgresqlflexibleserver.models.Replicas; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ResourceProviders; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerCapabilities; import com.azure.resourcemanager.postgresqlflexibleserver.models.Servers; import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsages; import java.time.Duration; @@ -70,6 +82,8 @@ public final class PostgreSqlManager { private LocationBasedCapabilities locationBasedCapabilities; + private ServerCapabilities serverCapabilities; + private CheckNameAvailabilities checkNameAvailabilities; private CheckNameAvailabilityWithLocations checkNameAvailabilityWithLocations; @@ -82,14 +96,24 @@ public final class PostgreSqlManager { private Servers servers; + private Migrations migrations; + + private ResourceProviders resourceProviders; + private Operations operations; private GetPrivateDnsZoneSuffixes getPrivateDnsZoneSuffixes; private Replicas replicas; + private LogFiles logFiles; + private VirtualNetworkSubnetUsages virtualNetworkSubnetUsages; + private FlexibleServers flexibleServers; + + private LtrBackupOperations ltrBackupOperations; + private final PostgreSqlManagementClient clientObject; private PostgreSqlManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -255,7 +279,7 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p .append("-") .append("com.azure.resourcemanager.postgresqlflexibleserver") .append("/") - .append("1.0.0-beta.6"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -349,6 +373,18 @@ public LocationBasedCapabilities locationBasedCapabilities() { return locationBasedCapabilities; } + /** + * Gets the resource collection API of ServerCapabilities. + * + * @return Resource collection API of ServerCapabilities. + */ + public ServerCapabilities serverCapabilities() { + if (this.serverCapabilities == null) { + this.serverCapabilities = new ServerCapabilitiesImpl(clientObject.getServerCapabilities(), this); + } + return serverCapabilities; + } + /** * Gets the resource collection API of CheckNameAvailabilities. * @@ -423,6 +459,30 @@ public Servers servers() { return servers; } + /** + * Gets the resource collection API of Migrations. It manages MigrationResource. + * + * @return Resource collection API of Migrations. + */ + public Migrations migrations() { + if (this.migrations == null) { + this.migrations = new MigrationsImpl(clientObject.getMigrations(), this); + } + return migrations; + } + + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + /** * Gets the resource collection API of Operations. * @@ -460,6 +520,18 @@ public Replicas replicas() { return replicas; } + /** + * Gets the resource collection API of LogFiles. + * + * @return Resource collection API of LogFiles. + */ + public LogFiles logFiles() { + if (this.logFiles == null) { + this.logFiles = new LogFilesImpl(clientObject.getLogFiles(), this); + } + return logFiles; + } + /** * Gets the resource collection API of VirtualNetworkSubnetUsages. * @@ -473,6 +545,30 @@ public VirtualNetworkSubnetUsages virtualNetworkSubnetUsages() { return virtualNetworkSubnetUsages; } + /** + * Gets the resource collection API of FlexibleServers. + * + * @return Resource collection API of FlexibleServers. + */ + public FlexibleServers flexibleServers() { + if (this.flexibleServers == null) { + this.flexibleServers = new FlexibleServersImpl(clientObject.getFlexibleServers(), this); + } + return flexibleServers; + } + + /** + * Gets the resource collection API of LtrBackupOperations. + * + * @return Resource collection API of LtrBackupOperations. + */ + public LtrBackupOperations ltrBackupOperations() { + if (this.ltrBackupOperations == null) { + this.ltrBackupOperations = new LtrBackupOperationsImpl(clientObject.getLtrBackupOperations(), this); + } + return ltrBackupOperations; + } + /** * @return Wrapped service client PostgreSqlManagementClient providing direct access to the underlying * auto-generated API implementation, based on Azure REST API. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FlexibleServersClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FlexibleServersClient.java new file mode 100644 index 0000000000000..8c7c5ecaad4eb --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FlexibleServersClient.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrBackupResponseInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrPreBackupResponseInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServersTriggerLtrPreBackupResponse; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrBackupRequest; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrPreBackupRequest; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FlexibleServersClient. */ +public interface FlexibleServersClient { + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR pre-backup API call on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono triggerLtrPreBackupWithResponseAsync( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters); + + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR pre-backup API call on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono triggerLtrPreBackupAsync( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters); + + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR pre-backup API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FlexibleServersTriggerLtrPreBackupResponse triggerLtrPreBackupWithResponse( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters, Context context); + + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR pre-backup API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LtrPreBackupResponseInner triggerLtrPreBackup( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters); + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> startLtrBackupWithResponseAsync( + String resourceGroupName, String serverName, LtrBackupRequest parameters); + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 PollerFlux} for polling of response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, LtrBackupResponseInner> beginStartLtrBackupAsync( + String resourceGroupName, String serverName, LtrBackupRequest parameters); + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LtrBackupResponseInner> beginStartLtrBackup( + String resourceGroupName, String serverName, LtrBackupRequest parameters); + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LtrBackupResponseInner> beginStartLtrBackup( + String resourceGroupName, String serverName, LtrBackupRequest parameters, Context context); + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono startLtrBackupAsync( + String resourceGroupName, String serverName, LtrBackupRequest parameters); + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LtrBackupResponseInner startLtrBackup(String resourceGroupName, String serverName, LtrBackupRequest parameters); + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LtrBackupResponseInner startLtrBackup( + String resourceGroupName, String serverName, LtrBackupRequest parameters, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java index a9bd53c696001..26e40020b46ba 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java @@ -9,7 +9,7 @@ import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner; /** An instance of this class provides access to all the operations defined in LocationBasedCapabilitiesClient. */ public interface LocationBasedCapabilitiesClient { @@ -23,7 +23,7 @@ public interface LocationBasedCapabilitiesClient { * @return capabilities at specified location in a given subscription as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedFlux executeAsync(String locationName); + PagedFlux executeAsync(String locationName); /** * Get capabilities at specified location in a given subscription. @@ -36,7 +36,7 @@ public interface LocationBasedCapabilitiesClient { * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable execute(String locationName); + PagedIterable execute(String locationName); /** * Get capabilities at specified location in a given subscription. @@ -50,5 +50,5 @@ public interface LocationBasedCapabilitiesClient { * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable execute(String locationName, Context context); + PagedIterable execute(String locationName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LogFilesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LogFilesClient.java new file mode 100644 index 0000000000000..695d001bdcc4d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LogFilesClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; + +/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +public interface LogFilesClient { + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(String resourceGroupName, String serverName); + + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LtrBackupOperationsClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LtrBackupOperationsClient.java new file mode 100644 index 0000000000000..da2f7cfadc198 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LtrBackupOperationsClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrServerBackupOperationInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LtrBackupOperationsClient. */ +public interface LtrBackupOperationsClient { + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @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 result of the give long term retention backup operation for the flexible server along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String backupName); + + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @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 result of the give long term retention backup operation for the flexible server on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String serverName, String backupName); + + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @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 result of the give long term retention backup operation for the flexible server along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String backupName, Context context); + + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @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 result of the give long term retention backup operation for the flexible server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LtrServerBackupOperationInner get(String resourceGroupName, String serverName, String backupName); + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 result of the give long term retention backup operations for the flexible server as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(String resourceGroupName, String serverName); + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 result of the give long term retention backup operations for the flexible server as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 result of the give long term retention backup operations for the flexible server as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/MigrationsClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/MigrationsClient.java new file mode 100644 index 0000000000000..7f35bd814f629 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/MigrationsClient.java @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationListFilter; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationResourceForPatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MigrationsClient. */ +public interface MigrationsClient { + /** + * Creates a new migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for creating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> createWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceInner parameters); + + /** + * Creates a new migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for creating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceInner parameters); + + /** + * Creates a new migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for creating a migration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceInner parameters, + Context context); + + /** + * Creates a new migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for creating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MigrationResourceInner create( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceInner parameters); + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 details of a migration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName); + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 details of a migration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName); + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 details of a migration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context); + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 details of a migration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MigrationResourceInner get( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName); + + /** + * Updates an existing migration. The request body can contain one to many of the mutable properties present in the + * migration definition. Certain property updates initiate migration state transitions. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for updating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> updateWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceForPatch parameters); + + /** + * Updates an existing migration. The request body can contain one to many of the mutable properties present in the + * migration definition. Certain property updates initiate migration state transitions. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for updating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono updateAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceForPatch parameters); + + /** + * Updates an existing migration. The request body can contain one to many of the mutable properties present in the + * migration definition. Certain property updates initiate migration state transitions. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for updating a migration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceForPatch parameters, + Context context); + + /** + * Updates an existing migration. The request body can contain one to many of the mutable properties present in the + * migration definition. Certain property updates initiate migration state transitions. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for updating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MigrationResourceInner update( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceForPatch parameters); + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> deleteWithResponseAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName); + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName); + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context); + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName); + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationListFilter Migration list filter. Retrieves either active migrations or all migrations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByTargetServerAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationListFilter migrationListFilter); + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByTargetServerAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName); + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTargetServer( + String subscriptionId, String resourceGroupName, String targetDbServerName); + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationListFilter Migration list filter. Retrieves either active migrations or all migrations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTargetServer( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationListFilter migrationListFilter, + Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java index f4253b4194d8a..0046679cf8987 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java @@ -65,6 +65,13 @@ public interface PostgreSqlManagementClient { */ LocationBasedCapabilitiesClient getLocationBasedCapabilities(); + /** + * Gets the ServerCapabilitiesClient object to access its operations. + * + * @return the ServerCapabilitiesClient object. + */ + ServerCapabilitiesClient getServerCapabilities(); + /** * Gets the CheckNameAvailabilitiesClient object to access its operations. * @@ -107,6 +114,20 @@ public interface PostgreSqlManagementClient { */ ServersClient getServers(); + /** + * Gets the MigrationsClient object to access its operations. + * + * @return the MigrationsClient object. + */ + MigrationsClient getMigrations(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + /** * Gets the OperationsClient object to access its operations. * @@ -128,10 +149,31 @@ public interface PostgreSqlManagementClient { */ ReplicasClient getReplicas(); + /** + * Gets the LogFilesClient object to access its operations. + * + * @return the LogFilesClient object. + */ + LogFilesClient getLogFiles(); + /** * Gets the VirtualNetworkSubnetUsagesClient object to access its operations. * * @return the VirtualNetworkSubnetUsagesClient object. */ VirtualNetworkSubnetUsagesClient getVirtualNetworkSubnetUsages(); + + /** + * Gets the FlexibleServersClient object to access its operations. + * + * @return the FlexibleServersClient object. + */ + FlexibleServersClient getFlexibleServers(); + + /** + * Gets the LtrBackupOperationsClient object to access its operations. + * + * @return the LtrBackupOperationsClient object. + */ + LtrBackupOperationsClient getLtrBackupOperations(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ResourceProvidersClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..5edf25d9e7ff2 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ResourceProvidersClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationNameAvailabilityResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> checkMigrationNameAvailabilityWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters); + + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono checkMigrationNameAvailabilityAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters); + + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkMigrationNameAvailabilityWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters, + Context context); + + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MigrationNameAvailabilityResourceInner checkMigrationNameAvailability( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerCapabilitiesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerCapabilitiesClient.java new file mode 100644 index 0000000000000..9c48b8acce17d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerCapabilitiesClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner; + +/** An instance of this class provides access to all the operations defined in ServerCapabilitiesClient. */ +public interface ServerCapabilitiesClient { + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 capabilities for a flexible server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(String resourceGroupName, String serverName); + + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 capabilities for a flexible server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName); + + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 capabilities for a flexible server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java deleted file mode 100644 index e0ecfaae1617d..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FastProvisioningEditionCapability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerEditionCapability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HyperscaleNodeEditionCapability; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Location capabilities. */ -@Immutable -public final class CapabilityPropertiesInner { - /* - * zone name - */ - @JsonProperty(value = "zone", access = JsonProperty.Access.WRITE_ONLY) - private String zone; - - /* - * Supported high availability mode - */ - @JsonProperty(value = "supportedHAMode", access = JsonProperty.Access.WRITE_ONLY) - private List supportedHAMode; - - /* - * A value indicating whether a new server in this region can have geo-backups to paired region. - */ - @JsonProperty(value = "geoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean geoBackupSupported; - - /* - * A value indicating whether a new server in this region can support multi zone HA. - */ - @JsonProperty(value = "zoneRedundantHaSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean zoneRedundantHaSupported; - - /* - * A value indicating whether a new server in this region can have geo-backups to paired region. - */ - @JsonProperty(value = "zoneRedundantHaAndGeoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean zoneRedundantHaAndGeoBackupSupported; - - /* - * The supportedFlexibleServerEditions property. - */ - @JsonProperty(value = "supportedFlexibleServerEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedFlexibleServerEditions; - - /* - * The supportedHyperscaleNodeEditions property. - */ - @JsonProperty(value = "supportedHyperscaleNodeEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedHyperscaleNodeEditions; - - /* - * A value indicating whether fast provisioning is supported in this region. - */ - @JsonProperty(value = "fastProvisioningSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean fastProvisioningSupported; - - /* - * The supportedFastProvisioningEditions property. - */ - @JsonProperty(value = "supportedFastProvisioningEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedFastProvisioningEditions; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** Creates an instance of CapabilityPropertiesInner class. */ - public CapabilityPropertiesInner() { - } - - /** - * Get the zone property: zone name. - * - * @return the zone value. - */ - public String zone() { - return this.zone; - } - - /** - * Get the supportedHAMode property: Supported high availability mode. - * - * @return the supportedHAMode value. - */ - public List supportedHAMode() { - return this.supportedHAMode; - } - - /** - * Get the geoBackupSupported property: A value indicating whether a new server in this region can have geo-backups - * to paired region. - * - * @return the geoBackupSupported value. - */ - public Boolean geoBackupSupported() { - return this.geoBackupSupported; - } - - /** - * Get the zoneRedundantHaSupported property: A value indicating whether a new server in this region can support - * multi zone HA. - * - * @return the zoneRedundantHaSupported value. - */ - public Boolean zoneRedundantHaSupported() { - return this.zoneRedundantHaSupported; - } - - /** - * Get the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether a new server in this region can - * have geo-backups to paired region. - * - * @return the zoneRedundantHaAndGeoBackupSupported value. - */ - public Boolean zoneRedundantHaAndGeoBackupSupported() { - return this.zoneRedundantHaAndGeoBackupSupported; - } - - /** - * Get the supportedFlexibleServerEditions property: The supportedFlexibleServerEditions property. - * - * @return the supportedFlexibleServerEditions value. - */ - public List supportedFlexibleServerEditions() { - return this.supportedFlexibleServerEditions; - } - - /** - * Get the supportedHyperscaleNodeEditions property: The supportedHyperscaleNodeEditions property. - * - * @return the supportedHyperscaleNodeEditions value. - */ - public List supportedHyperscaleNodeEditions() { - return this.supportedHyperscaleNodeEditions; - } - - /** - * Get the fastProvisioningSupported property: A value indicating whether fast provisioning is supported in this - * region. - * - * @return the fastProvisioningSupported value. - */ - public Boolean fastProvisioningSupported() { - return this.fastProvisioningSupported; - } - - /** - * Get the supportedFastProvisioningEditions property: The supportedFastProvisioningEditions property. - * - * @return the supportedFastProvisioningEditions value. - */ - public List supportedFastProvisioningEditions() { - return this.supportedFastProvisioningEditions; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedFlexibleServerEditions() != null) { - supportedFlexibleServerEditions().forEach(e -> e.validate()); - } - if (supportedHyperscaleNodeEditions() != null) { - supportedHyperscaleNodeEditions().forEach(e -> e.validate()); - } - if (supportedFastProvisioningEditions() != null) { - supportedFastProvisioningEditions().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FlexibleServerCapabilityInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FlexibleServerCapabilityInner.java new file mode 100644 index 0000000000000..de5d3fc021a3f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FlexibleServerCapabilityInner.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilityBase; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FastProvisioningEditionCapability; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FastProvisioningSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerEditionCapability; +import com.azure.resourcemanager.postgresqlflexibleserver.models.GeoBackupSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.OnlineResizeSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RestrictedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersionCapability; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrowthSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ZoneRedundantHaAndGeoBackupSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ZoneRedundantHaSupportedEnum; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Capability for the PostgreSQL server. */ +@Fluent +public final class FlexibleServerCapabilityInner extends CapabilityBase { + /* + * Name of flexible servers capability + */ + @JsonProperty(value = "name") + private String name; + + /* + * List of supported flexible server editions + */ + @JsonProperty(value = "supportedServerEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServerEditions; + + /* + * The list of server versions supported for this capability. + */ + @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServerVersions; + + /* + * Gets a value indicating whether fast provisioning is supported. "Enabled" means fast provisioning is supported. + * "Disabled" stands for fast provisioning is not supported. + */ + @JsonProperty(value = "fastProvisioningSupported", access = JsonProperty.Access.WRITE_ONLY) + private FastProvisioningSupportedEnum fastProvisioningSupported; + + /* + * List of supported server editions for fast provisioning + */ + @JsonProperty(value = "supportedFastProvisioningEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedFastProvisioningEditions; + + /* + * Determines if geo-backup is supported in this region. "Enabled" means geo-backup is supported. "Disabled" stands + * for geo-back is not supported. + */ + @JsonProperty(value = "geoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) + private GeoBackupSupportedEnum geoBackupSupported; + + /* + * A value indicating whether Zone Redundant HA is supported in this region. "Enabled" means zone redundant HA is + * supported. "Disabled" stands for zone redundant HA is not supported. + */ + @JsonProperty(value = "zoneRedundantHaSupported", access = JsonProperty.Access.WRITE_ONLY) + private ZoneRedundantHaSupportedEnum zoneRedundantHaSupported; + + /* + * A value indicating whether Zone Redundant HA and Geo-backup is supported in this region. "Enabled" means zone + * redundant HA and geo-backup is supported. "Disabled" stands for zone redundant HA and geo-backup is not + * supported. + */ + @JsonProperty(value = "zoneRedundantHaAndGeoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) + private ZoneRedundantHaAndGeoBackupSupportedEnum zoneRedundantHaAndGeoBackupSupported; + + /* + * A value indicating whether storage auto-grow is supported in this region. "Enabled" means storage auto-grow is + * supported. "Disabled" stands for storage auto-grow is not supported. + */ + @JsonProperty(value = "storageAutoGrowthSupported", access = JsonProperty.Access.WRITE_ONLY) + private StorageAutoGrowthSupportedEnum storageAutoGrowthSupported; + + /* + * A value indicating whether online resize is supported in this region for the given subscription. "Enabled" means + * storage online resize is supported. "Disabled" means storage online resize is not supported. + */ + @JsonProperty(value = "onlineResizeSupported", access = JsonProperty.Access.WRITE_ONLY) + private OnlineResizeSupportedEnum onlineResizeSupported; + + /* + * A value indicating whether this region is restricted. "Enabled" means region is restricted. "Disabled" stands + * for region is not restricted. + */ + @JsonProperty(value = "restricted", access = JsonProperty.Access.WRITE_ONLY) + private RestrictedEnum restricted; + + /** Creates an instance of FlexibleServerCapabilityInner class. */ + public FlexibleServerCapabilityInner() { + } + + /** + * Get the name property: Name of flexible servers capability. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of flexible servers capability. + * + * @param name the name value to set. + * @return the FlexibleServerCapabilityInner object itself. + */ + public FlexibleServerCapabilityInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the supportedServerEditions property: List of supported flexible server editions. + * + * @return the supportedServerEditions value. + */ + public List supportedServerEditions() { + return this.supportedServerEditions; + } + + /** + * Get the supportedServerVersions property: The list of server versions supported for this capability. + * + * @return the supportedServerVersions value. + */ + public List supportedServerVersions() { + return this.supportedServerVersions; + } + + /** + * Get the fastProvisioningSupported property: Gets a value indicating whether fast provisioning is supported. + * "Enabled" means fast provisioning is supported. "Disabled" stands for fast provisioning is not supported. + * + * @return the fastProvisioningSupported value. + */ + public FastProvisioningSupportedEnum fastProvisioningSupported() { + return this.fastProvisioningSupported; + } + + /** + * Get the supportedFastProvisioningEditions property: List of supported server editions for fast provisioning. + * + * @return the supportedFastProvisioningEditions value. + */ + public List supportedFastProvisioningEditions() { + return this.supportedFastProvisioningEditions; + } + + /** + * Get the geoBackupSupported property: Determines if geo-backup is supported in this region. "Enabled" means + * geo-backup is supported. "Disabled" stands for geo-back is not supported. + * + * @return the geoBackupSupported value. + */ + public GeoBackupSupportedEnum geoBackupSupported() { + return this.geoBackupSupported; + } + + /** + * Get the zoneRedundantHaSupported property: A value indicating whether Zone Redundant HA is supported in this + * region. "Enabled" means zone redundant HA is supported. "Disabled" stands for zone redundant HA is not supported. + * + * @return the zoneRedundantHaSupported value. + */ + public ZoneRedundantHaSupportedEnum zoneRedundantHaSupported() { + return this.zoneRedundantHaSupported; + } + + /** + * Get the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether Zone Redundant HA and + * Geo-backup is supported in this region. "Enabled" means zone redundant HA and geo-backup is supported. "Disabled" + * stands for zone redundant HA and geo-backup is not supported. + * + * @return the zoneRedundantHaAndGeoBackupSupported value. + */ + public ZoneRedundantHaAndGeoBackupSupportedEnum zoneRedundantHaAndGeoBackupSupported() { + return this.zoneRedundantHaAndGeoBackupSupported; + } + + /** + * Get the storageAutoGrowthSupported property: A value indicating whether storage auto-grow is supported in this + * region. "Enabled" means storage auto-grow is supported. "Disabled" stands for storage auto-grow is not supported. + * + * @return the storageAutoGrowthSupported value. + */ + public StorageAutoGrowthSupportedEnum storageAutoGrowthSupported() { + return this.storageAutoGrowthSupported; + } + + /** + * Get the onlineResizeSupported property: A value indicating whether online resize is supported in this region for + * the given subscription. "Enabled" means storage online resize is supported. "Disabled" means storage online + * resize is not supported. + * + * @return the onlineResizeSupported value. + */ + public OnlineResizeSupportedEnum onlineResizeSupported() { + return this.onlineResizeSupported; + } + + /** + * Get the restricted property: A value indicating whether this region is restricted. "Enabled" means region is + * restricted. "Disabled" stands for region is not restricted. + * + * @return the restricted value. + */ + public RestrictedEnum restricted() { + return this.restricted; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (supportedServerEditions() != null) { + supportedServerEditions().forEach(e -> e.validate()); + } + if (supportedServerVersions() != null) { + supportedServerVersions().forEach(e -> e.validate()); + } + if (supportedFastProvisioningEditions() != null) { + supportedFastProvisioningEditions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileInner.java new file mode 100644 index 0000000000000..e8848a5d625fe --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileInner.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a logFile. */ +@Fluent +public final class LogFileInner extends ProxyResource { + /* + * The properties of a logFile. + */ + @JsonProperty(value = "properties") + private LogFileProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of LogFileInner class. */ + public LogFileInner() { + } + + /** + * Get the innerProperties property: The properties of a logFile. + * + * @return the innerProperties value. + */ + private LogFileProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 createdTime property: Creation timestamp of the log file. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.innerProperties() == null ? null : this.innerProperties().createdTime(); + } + + /** + * Set the createdTime property: Creation timestamp of the log file. + * + * @param createdTime the createdTime value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withCreatedTime(OffsetDateTime createdTime) { + if (this.innerProperties() == null) { + this.innerProperties = new LogFileProperties(); + } + this.innerProperties().withCreatedTime(createdTime); + return this; + } + + /** + * Get the lastModifiedTime property: Last modified timestamp of the log file. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime(); + } + + /** + * Set the lastModifiedTime property: Last modified timestamp of the log file. + * + * @param lastModifiedTime the lastModifiedTime value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withLastModifiedTime(OffsetDateTime lastModifiedTime) { + if (this.innerProperties() == null) { + this.innerProperties = new LogFileProperties(); + } + this.innerProperties().withLastModifiedTime(lastModifiedTime); + return this; + } + + /** + * Get the sizeInKb property: The size in kb of the logFile. + * + * @return the sizeInKb value. + */ + public Long sizeInKb() { + return this.innerProperties() == null ? null : this.innerProperties().sizeInKb(); + } + + /** + * Set the sizeInKb property: The size in kb of the logFile. + * + * @param sizeInKb the sizeInKb value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withSizeInKb(Long sizeInKb) { + if (this.innerProperties() == null) { + this.innerProperties = new LogFileProperties(); + } + this.innerProperties().withSizeInKb(sizeInKb); + return this; + } + + /** + * Get the type property: Type of the log file. + * + * @return the type value. + */ + public String typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Type of the log file. + * + * @param type the type value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withTypePropertiesType(String type) { + if (this.innerProperties() == null) { + this.innerProperties = new LogFileProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the url property: The url to download the log file from. + * + * @return the url value. + */ + public String url() { + return this.innerProperties() == null ? null : this.innerProperties().url(); + } + + /** + * Set the url property: The url to download the log file from. + * + * @param url the url value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withUrl(String url) { + if (this.innerProperties() == null) { + this.innerProperties = new LogFileProperties(); + } + this.innerProperties().withUrl(url); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileProperties.java new file mode 100644 index 0000000000000..310837942f8fb --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileProperties.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a logFile. */ +@Fluent +public final class LogFileProperties { + /* + * Creation timestamp of the log file. + */ + @JsonProperty(value = "createdTime") + private OffsetDateTime createdTime; + + /* + * Last modified timestamp of the log file. + */ + @JsonProperty(value = "lastModifiedTime") + private OffsetDateTime lastModifiedTime; + + /* + * The size in kb of the logFile. + */ + @JsonProperty(value = "sizeInKb") + private Long sizeInKb; + + /* + * Type of the log file. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The url to download the log file from. + */ + @JsonProperty(value = "url") + private String url; + + /** Creates an instance of LogFileProperties class. */ + public LogFileProperties() { + } + + /** + * Get the createdTime property: Creation timestamp of the log file. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Set the createdTime property: Creation timestamp of the log file. + * + * @param createdTime the createdTime value to set. + * @return the LogFileProperties object itself. + */ + public LogFileProperties withCreatedTime(OffsetDateTime createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get the lastModifiedTime property: Last modified timestamp of the log file. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Set the lastModifiedTime property: Last modified timestamp of the log file. + * + * @param lastModifiedTime the lastModifiedTime value to set. + * @return the LogFileProperties object itself. + */ + public LogFileProperties withLastModifiedTime(OffsetDateTime lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; + return this; + } + + /** + * Get the sizeInKb property: The size in kb of the logFile. + * + * @return the sizeInKb value. + */ + public Long sizeInKb() { + return this.sizeInKb; + } + + /** + * Set the sizeInKb property: The size in kb of the logFile. + * + * @param sizeInKb the sizeInKb value to set. + * @return the LogFileProperties object itself. + */ + public LogFileProperties withSizeInKb(Long sizeInKb) { + this.sizeInKb = sizeInKb; + return this; + } + + /** + * Get the type property: Type of the log file. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Type of the log file. + * + * @param type the type value to set. + * @return the LogFileProperties object itself. + */ + public LogFileProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the url property: The url to download the log file from. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: The url to download the log file from. + * + * @param url the url value to set. + * @return the LogFileProperties object itself. + */ + public LogFileProperties withUrl(String url) { + this.url = url; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrBackupOperationResponseProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrBackupOperationResponseProperties.java new file mode 100644 index 0000000000000..8c4a2c0237b09 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrBackupOperationResponseProperties.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ExecutionStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Response for the backup request. */ +@Fluent +public final class LtrBackupOperationResponseProperties { + /* + * Size of datasource in bytes + */ + @JsonProperty(value = "datasourceSizeInBytes") + private Long datasourceSizeInBytes; + + /* + * Data transferred in bytes + */ + @JsonProperty(value = "dataTransferredInBytes") + private Long dataTransferredInBytes; + + /* + * Name of Backup operation + */ + @JsonProperty(value = "backupName") + private String backupName; + + /* + * Metadata to be stored in RP. Store everything that will be required to perform a successful restore using this + * Recovery point. e.g. Versions, DataFormat etc + */ + @JsonProperty(value = "backupMetadata") + private String backupMetadata; + + /* + * Service-set extensible enum indicating the status of operation + */ + @JsonProperty(value = "status", required = true) + private ExecutionStatus status; + + /* + * Start time of the operation. + */ + @JsonProperty(value = "startTime", required = true) + private OffsetDateTime startTime; + + /* + * End time of the operation. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * PercentageCompleted + */ + @JsonProperty(value = "percentComplete") + private Double percentComplete; + + /* + * The error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private String errorCode; + + /* + * The error message. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** Creates an instance of LtrBackupOperationResponseProperties class. */ + public LtrBackupOperationResponseProperties() { + } + + /** + * Get the datasourceSizeInBytes property: Size of datasource in bytes. + * + * @return the datasourceSizeInBytes value. + */ + public Long datasourceSizeInBytes() { + return this.datasourceSizeInBytes; + } + + /** + * Set the datasourceSizeInBytes property: Size of datasource in bytes. + * + * @param datasourceSizeInBytes the datasourceSizeInBytes value to set. + * @return the LtrBackupOperationResponseProperties object itself. + */ + public LtrBackupOperationResponseProperties withDatasourceSizeInBytes(Long datasourceSizeInBytes) { + this.datasourceSizeInBytes = datasourceSizeInBytes; + return this; + } + + /** + * Get the dataTransferredInBytes property: Data transferred in bytes. + * + * @return the dataTransferredInBytes value. + */ + public Long dataTransferredInBytes() { + return this.dataTransferredInBytes; + } + + /** + * Set the dataTransferredInBytes property: Data transferred in bytes. + * + * @param dataTransferredInBytes the dataTransferredInBytes value to set. + * @return the LtrBackupOperationResponseProperties object itself. + */ + public LtrBackupOperationResponseProperties withDataTransferredInBytes(Long dataTransferredInBytes) { + this.dataTransferredInBytes = dataTransferredInBytes; + return this; + } + + /** + * Get the backupName property: Name of Backup operation. + * + * @return the backupName value. + */ + public String backupName() { + return this.backupName; + } + + /** + * Set the backupName property: Name of Backup operation. + * + * @param backupName the backupName value to set. + * @return the LtrBackupOperationResponseProperties object itself. + */ + public LtrBackupOperationResponseProperties withBackupName(String backupName) { + this.backupName = backupName; + return this; + } + + /** + * Get the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform a + * successful restore using this Recovery point. e.g. Versions, DataFormat etc. + * + * @return the backupMetadata value. + */ + public String backupMetadata() { + return this.backupMetadata; + } + + /** + * Set the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform a + * successful restore using this Recovery point. e.g. Versions, DataFormat etc. + * + * @param backupMetadata the backupMetadata value to set. + * @return the LtrBackupOperationResponseProperties object itself. + */ + public LtrBackupOperationResponseProperties withBackupMetadata(String backupMetadata) { + this.backupMetadata = backupMetadata; + return this; + } + + /** + * Get the status property: Service-set extensible enum indicating the status of operation. + * + * @return the status value. + */ + public ExecutionStatus status() { + return this.status; + } + + /** + * Set the status property: Service-set extensible enum indicating the status of operation. + * + * @param status the status value to set. + * @return the LtrBackupOperationResponseProperties object itself. + */ + public LtrBackupOperationResponseProperties withStatus(ExecutionStatus status) { + this.status = status; + return this; + } + + /** + * Get the startTime property: Start time of the operation. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time of the operation. + * + * @param startTime the startTime value to set. + * @return the LtrBackupOperationResponseProperties object itself. + */ + public LtrBackupOperationResponseProperties withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: End time of the operation. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: End time of the operation. + * + * @param endTime the endTime value to set. + * @return the LtrBackupOperationResponseProperties object itself. + */ + public LtrBackupOperationResponseProperties withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the percentComplete property: PercentageCompleted. + * + * @return the percentComplete value. + */ + public Double percentComplete() { + return this.percentComplete; + } + + /** + * Set the percentComplete property: PercentageCompleted. + * + * @param percentComplete the percentComplete value to set. + * @return the LtrBackupOperationResponseProperties object itself. + */ + public LtrBackupOperationResponseProperties withPercentComplete(Double percentComplete) { + this.percentComplete = percentComplete; + return this; + } + + /** + * Get the errorCode property: The error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: The error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model LtrBackupOperationResponseProperties")); + } + if (startTime() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property startTime in model LtrBackupOperationResponseProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LtrBackupOperationResponseProperties.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrBackupResponseInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrBackupResponseInner.java new file mode 100644 index 0000000000000..cae25402c0bbe --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrBackupResponseInner.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ExecutionStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Response for the LTR backup API call. */ +@Fluent +public final class LtrBackupResponseInner { + /* + * Long Term Retention Backup Operation Resource Properties + */ + @JsonProperty(value = "properties") + private LtrBackupOperationResponseProperties innerProperties; + + /** Creates an instance of LtrBackupResponseInner class. */ + public LtrBackupResponseInner() { + } + + /** + * Get the innerProperties property: Long Term Retention Backup Operation Resource Properties. + * + * @return the innerProperties value. + */ + private LtrBackupOperationResponseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the datasourceSizeInBytes property: Size of datasource in bytes. + * + * @return the datasourceSizeInBytes value. + */ + public Long datasourceSizeInBytes() { + return this.innerProperties() == null ? null : this.innerProperties().datasourceSizeInBytes(); + } + + /** + * Set the datasourceSizeInBytes property: Size of datasource in bytes. + * + * @param datasourceSizeInBytes the datasourceSizeInBytes value to set. + * @return the LtrBackupResponseInner object itself. + */ + public LtrBackupResponseInner withDatasourceSizeInBytes(Long datasourceSizeInBytes) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withDatasourceSizeInBytes(datasourceSizeInBytes); + return this; + } + + /** + * Get the dataTransferredInBytes property: Data transferred in bytes. + * + * @return the dataTransferredInBytes value. + */ + public Long dataTransferredInBytes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTransferredInBytes(); + } + + /** + * Set the dataTransferredInBytes property: Data transferred in bytes. + * + * @param dataTransferredInBytes the dataTransferredInBytes value to set. + * @return the LtrBackupResponseInner object itself. + */ + public LtrBackupResponseInner withDataTransferredInBytes(Long dataTransferredInBytes) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withDataTransferredInBytes(dataTransferredInBytes); + return this; + } + + /** + * Get the backupName property: Name of Backup operation. + * + * @return the backupName value. + */ + public String backupName() { + return this.innerProperties() == null ? null : this.innerProperties().backupName(); + } + + /** + * Set the backupName property: Name of Backup operation. + * + * @param backupName the backupName value to set. + * @return the LtrBackupResponseInner object itself. + */ + public LtrBackupResponseInner withBackupName(String backupName) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withBackupName(backupName); + return this; + } + + /** + * Get the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform a + * successful restore using this Recovery point. e.g. Versions, DataFormat etc. + * + * @return the backupMetadata value. + */ + public String backupMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().backupMetadata(); + } + + /** + * Set the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform a + * successful restore using this Recovery point. e.g. Versions, DataFormat etc. + * + * @param backupMetadata the backupMetadata value to set. + * @return the LtrBackupResponseInner object itself. + */ + public LtrBackupResponseInner withBackupMetadata(String backupMetadata) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withBackupMetadata(backupMetadata); + return this; + } + + /** + * Get the status property: Service-set extensible enum indicating the status of operation. + * + * @return the status value. + */ + public ExecutionStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: Service-set extensible enum indicating the status of operation. + * + * @param status the status value to set. + * @return the LtrBackupResponseInner object itself. + */ + public LtrBackupResponseInner withStatus(ExecutionStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the startTime property: Start time of the operation. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Set the startTime property: Start time of the operation. + * + * @param startTime the startTime value to set. + * @return the LtrBackupResponseInner object itself. + */ + public LtrBackupResponseInner withStartTime(OffsetDateTime startTime) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withStartTime(startTime); + return this; + } + + /** + * Get the endTime property: End time of the operation. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Set the endTime property: End time of the operation. + * + * @param endTime the endTime value to set. + * @return the LtrBackupResponseInner object itself. + */ + public LtrBackupResponseInner withEndTime(OffsetDateTime endTime) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withEndTime(endTime); + return this; + } + + /** + * Get the percentComplete property: PercentageCompleted. + * + * @return the percentComplete value. + */ + public Double percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Set the percentComplete property: PercentageCompleted. + * + * @param percentComplete the percentComplete value to set. + * @return the LtrBackupResponseInner object itself. + */ + public LtrBackupResponseInner withPercentComplete(Double percentComplete) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withPercentComplete(percentComplete); + return this; + } + + /** + * Get the errorCode property: The error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorMessage property: The error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrPreBackupResponseInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrPreBackupResponseInner.java new file mode 100644 index 0000000000000..addae5eee73a1 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrPreBackupResponseInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response for the LTR pre-backup API call. */ +@Fluent +public final class LtrPreBackupResponseInner { + /* + * Additional Properties for the pre backup response + */ + @JsonProperty(value = "properties", required = true) + private LtrPreBackupResponseProperties innerProperties = new LtrPreBackupResponseProperties(); + + /** Creates an instance of LtrPreBackupResponseInner class. */ + public LtrPreBackupResponseInner() { + } + + /** + * Get the innerProperties property: Additional Properties for the pre backup response. + * + * @return the innerProperties value. + */ + private LtrPreBackupResponseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the numberOfContainers property: Number of storage containers the plugin will use during backup. More than + * one containers may be used for size limitations, parallelism, or redundancy etc. + * + * @return the numberOfContainers value. + */ + public int numberOfContainers() { + return this.innerProperties() == null ? 0 : this.innerProperties().numberOfContainers(); + } + + /** + * Set the numberOfContainers property: Number of storage containers the plugin will use during backup. More than + * one containers may be used for size limitations, parallelism, or redundancy etc. + * + * @param numberOfContainers the numberOfContainers value to set. + * @return the LtrPreBackupResponseInner object itself. + */ + public LtrPreBackupResponseInner withNumberOfContainers(int numberOfContainers) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrPreBackupResponseProperties(); + } + this.innerProperties().withNumberOfContainers(numberOfContainers); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model LtrPreBackupResponseInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LtrPreBackupResponseInner.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrPreBackupResponseProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrPreBackupResponseProperties.java new file mode 100644 index 0000000000000..968c034704f4f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrPreBackupResponseProperties.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response for the pre-backup request. */ +@Fluent +public final class LtrPreBackupResponseProperties { + /* + * Number of storage containers the plugin will use during backup. More than one containers may be used for size + * limitations, parallelism, or redundancy etc. + */ + @JsonProperty(value = "numberOfContainers", required = true) + private int numberOfContainers; + + /** Creates an instance of LtrPreBackupResponseProperties class. */ + public LtrPreBackupResponseProperties() { + } + + /** + * Get the numberOfContainers property: Number of storage containers the plugin will use during backup. More than + * one containers may be used for size limitations, parallelism, or redundancy etc. + * + * @return the numberOfContainers value. + */ + public int numberOfContainers() { + return this.numberOfContainers; + } + + /** + * Set the numberOfContainers property: Number of storage containers the plugin will use during backup. More than + * one containers may be used for size limitations, parallelism, or redundancy etc. + * + * @param numberOfContainers the numberOfContainers value to set. + * @return the LtrPreBackupResponseProperties object itself. + */ + public LtrPreBackupResponseProperties withNumberOfContainers(int numberOfContainers) { + this.numberOfContainers = numberOfContainers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrServerBackupOperationInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrServerBackupOperationInner.java new file mode 100644 index 0000000000000..39f221b5c5e33 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LtrServerBackupOperationInner.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ExecutionStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Response for the LTR backup Operation API call. */ +@Fluent +public final class LtrServerBackupOperationInner extends ProxyResource { + /* + * Long Term Retention Backup Operation Resource Properties + */ + @JsonProperty(value = "properties") + private LtrBackupOperationResponseProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of LtrServerBackupOperationInner class. */ + public LtrServerBackupOperationInner() { + } + + /** + * Get the innerProperties property: Long Term Retention Backup Operation Resource Properties. + * + * @return the innerProperties value. + */ + private LtrBackupOperationResponseProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 datasourceSizeInBytes property: Size of datasource in bytes. + * + * @return the datasourceSizeInBytes value. + */ + public Long datasourceSizeInBytes() { + return this.innerProperties() == null ? null : this.innerProperties().datasourceSizeInBytes(); + } + + /** + * Set the datasourceSizeInBytes property: Size of datasource in bytes. + * + * @param datasourceSizeInBytes the datasourceSizeInBytes value to set. + * @return the LtrServerBackupOperationInner object itself. + */ + public LtrServerBackupOperationInner withDatasourceSizeInBytes(Long datasourceSizeInBytes) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withDatasourceSizeInBytes(datasourceSizeInBytes); + return this; + } + + /** + * Get the dataTransferredInBytes property: Data transferred in bytes. + * + * @return the dataTransferredInBytes value. + */ + public Long dataTransferredInBytes() { + return this.innerProperties() == null ? null : this.innerProperties().dataTransferredInBytes(); + } + + /** + * Set the dataTransferredInBytes property: Data transferred in bytes. + * + * @param dataTransferredInBytes the dataTransferredInBytes value to set. + * @return the LtrServerBackupOperationInner object itself. + */ + public LtrServerBackupOperationInner withDataTransferredInBytes(Long dataTransferredInBytes) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withDataTransferredInBytes(dataTransferredInBytes); + return this; + } + + /** + * Get the backupName property: Name of Backup operation. + * + * @return the backupName value. + */ + public String backupName() { + return this.innerProperties() == null ? null : this.innerProperties().backupName(); + } + + /** + * Set the backupName property: Name of Backup operation. + * + * @param backupName the backupName value to set. + * @return the LtrServerBackupOperationInner object itself. + */ + public LtrServerBackupOperationInner withBackupName(String backupName) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withBackupName(backupName); + return this; + } + + /** + * Get the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform a + * successful restore using this Recovery point. e.g. Versions, DataFormat etc. + * + * @return the backupMetadata value. + */ + public String backupMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().backupMetadata(); + } + + /** + * Set the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform a + * successful restore using this Recovery point. e.g. Versions, DataFormat etc. + * + * @param backupMetadata the backupMetadata value to set. + * @return the LtrServerBackupOperationInner object itself. + */ + public LtrServerBackupOperationInner withBackupMetadata(String backupMetadata) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withBackupMetadata(backupMetadata); + return this; + } + + /** + * Get the status property: Service-set extensible enum indicating the status of operation. + * + * @return the status value. + */ + public ExecutionStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: Service-set extensible enum indicating the status of operation. + * + * @param status the status value to set. + * @return the LtrServerBackupOperationInner object itself. + */ + public LtrServerBackupOperationInner withStatus(ExecutionStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the startTime property: Start time of the operation. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Set the startTime property: Start time of the operation. + * + * @param startTime the startTime value to set. + * @return the LtrServerBackupOperationInner object itself. + */ + public LtrServerBackupOperationInner withStartTime(OffsetDateTime startTime) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withStartTime(startTime); + return this; + } + + /** + * Get the endTime property: End time of the operation. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Set the endTime property: End time of the operation. + * + * @param endTime the endTime value to set. + * @return the LtrServerBackupOperationInner object itself. + */ + public LtrServerBackupOperationInner withEndTime(OffsetDateTime endTime) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withEndTime(endTime); + return this; + } + + /** + * Get the percentComplete property: PercentageCompleted. + * + * @return the percentComplete value. + */ + public Double percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Set the percentComplete property: PercentageCompleted. + * + * @param percentComplete the percentComplete value to set. + * @return the LtrServerBackupOperationInner object itself. + */ + public LtrServerBackupOperationInner withPercentComplete(Double percentComplete) { + if (this.innerProperties() == null) { + this.innerProperties = new LtrBackupOperationResponseProperties(); + } + this.innerProperties().withPercentComplete(percentComplete); + return this; + } + + /** + * Get the errorCode property: The error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorMessage property: The error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationNameAvailabilityResourceInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationNameAvailabilityResourceInner.java new file mode 100644 index 0000000000000..80c281290c364 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationNameAvailabilityResourceInner.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a migration name's availability. */ +@Fluent +public final class MigrationNameAvailabilityResourceInner { + /* + * The resource name to verify. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The type of the resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * Indicates whether the resource name is available. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /* + * Migration name availability reason + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private MigrationNameAvailabilityReason reason; + + /* + * Migration name availability message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** Creates an instance of MigrationNameAvailabilityResourceInner class. */ + public MigrationNameAvailabilityResourceInner() { + } + + /** + * Get the name property: The resource name to verify. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The resource name to verify. + * + * @param name the name value to set. + * @return the MigrationNameAvailabilityResourceInner object itself. + */ + public MigrationNameAvailabilityResourceInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of the resource. + * + * @param type the type value to set. + * @return the MigrationNameAvailabilityResourceInner object itself. + */ + public MigrationNameAvailabilityResourceInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the nameAvailable property: Indicates whether the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: Migration name availability reason. + * + * @return the reason value. + */ + public MigrationNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: Migration name availability message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model MigrationNameAvailabilityResourceInner")); + } + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model MigrationNameAvailabilityResourceInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MigrationNameAvailabilityResourceInner.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationResourceInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationResourceInner.java new file mode 100644 index 0000000000000..1e6f37f04ba0b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationResourceInner.java @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlflexibleserver.models.CancelEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.DbServerMetadata; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogicalReplicationOnSourceDbEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationMode; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationSecretParameters; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationStatus; +import com.azure.resourcemanager.postgresqlflexibleserver.models.OverwriteDbsInTargetEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StartDataMigrationEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.TriggerCutoverEnum; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Represents a migration resource. */ +@Fluent +public final class MigrationResourceInner extends Resource { + /* + * Migration resource properties. + */ + @JsonProperty(value = "properties") + private MigrationResourceProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of MigrationResourceInner class. */ + public MigrationResourceInner() { + } + + /** + * Get the innerProperties property: Migration resource properties. + * + * @return the innerProperties value. + */ + private MigrationResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public MigrationResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MigrationResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the migrationId property: ID for migration, a GUID. + * + * @return the migrationId value. + */ + public String migrationId() { + return this.innerProperties() == null ? null : this.innerProperties().migrationId(); + } + + /** + * Get the currentStatus property: Current status of migration. + * + * @return the currentStatus value. + */ + public MigrationStatus currentStatus() { + return this.innerProperties() == null ? null : this.innerProperties().currentStatus(); + } + + /** + * Get the migrationMode property: There are two types of migration modes Online and Offline. + * + * @return the migrationMode value. + */ + public MigrationMode migrationMode() { + return this.innerProperties() == null ? null : this.innerProperties().migrationMode(); + } + + /** + * Set the migrationMode property: There are two types of migration modes Online and Offline. + * + * @param migrationMode the migrationMode value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withMigrationMode(MigrationMode migrationMode) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withMigrationMode(migrationMode); + return this; + } + + /** + * Get the sourceDbServerMetadata property: Metadata of the source database server. + * + * @return the sourceDbServerMetadata value. + */ + public DbServerMetadata sourceDbServerMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDbServerMetadata(); + } + + /** + * Get the targetDbServerMetadata property: Metadata of the target database server. + * + * @return the targetDbServerMetadata value. + */ + public DbServerMetadata targetDbServerMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().targetDbServerMetadata(); + } + + /** + * Get the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @return the sourceDbServerResourceId value. + */ + public String sourceDbServerResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDbServerResourceId(); + } + + /** + * Set the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @param sourceDbServerResourceId the sourceDbServerResourceId value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withSourceDbServerResourceId(String sourceDbServerResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withSourceDbServerResourceId(sourceDbServerResourceId); + return this; + } + + /** + * Get the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @return the sourceDbServerFullyQualifiedDomainName value. + */ + public String sourceDbServerFullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDbServerFullyQualifiedDomainName(); + } + + /** + * Set the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @param sourceDbServerFullyQualifiedDomainName the sourceDbServerFullyQualifiedDomainName value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withSourceDbServerFullyQualifiedDomainName( + String sourceDbServerFullyQualifiedDomainName) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withSourceDbServerFullyQualifiedDomainName(sourceDbServerFullyQualifiedDomainName); + return this; + } + + /** + * Get the targetDbServerResourceId property: ResourceId of the source database server. + * + * @return the targetDbServerResourceId value. + */ + public String targetDbServerResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetDbServerResourceId(); + } + + /** + * Get the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @return the targetDbServerFullyQualifiedDomainName value. + */ + public String targetDbServerFullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().targetDbServerFullyQualifiedDomainName(); + } + + /** + * Set the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @param targetDbServerFullyQualifiedDomainName the targetDbServerFullyQualifiedDomainName value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withTargetDbServerFullyQualifiedDomainName( + String targetDbServerFullyQualifiedDomainName) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withTargetDbServerFullyQualifiedDomainName(targetDbServerFullyQualifiedDomainName); + return this; + } + + /** + * Get the secretParameters property: Migration secret parameters. + * + * @return the secretParameters value. + */ + public MigrationSecretParameters secretParameters() { + return this.innerProperties() == null ? null : this.innerProperties().secretParameters(); + } + + /** + * Set the secretParameters property: Migration secret parameters. + * + * @param secretParameters the secretParameters value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withSecretParameters(MigrationSecretParameters secretParameters) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withSecretParameters(secretParameters); + return this; + } + + /** + * Get the dbsToMigrate property: Number of databases to migrate. + * + * @return the dbsToMigrate value. + */ + public List dbsToMigrate() { + return this.innerProperties() == null ? null : this.innerProperties().dbsToMigrate(); + } + + /** + * Set the dbsToMigrate property: Number of databases to migrate. + * + * @param dbsToMigrate the dbsToMigrate value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withDbsToMigrate(List dbsToMigrate) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withDbsToMigrate(dbsToMigrate); + return this; + } + + /** + * Get the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @return the setupLogicalReplicationOnSourceDbIfNeeded value. + */ + public LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded() { + return this.innerProperties() == null + ? null + : this.innerProperties().setupLogicalReplicationOnSourceDbIfNeeded(); + } + + /** + * Set the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @param setupLogicalReplicationOnSourceDbIfNeeded the setupLogicalReplicationOnSourceDbIfNeeded value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withSetupLogicalReplicationOnSourceDbIfNeeded( + LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withSetupLogicalReplicationOnSourceDbIfNeeded(setupLogicalReplicationOnSourceDbIfNeeded); + return this; + } + + /** + * Get the overwriteDbsInTarget property: Indicates whether the databases on the target server can be overwritten, + * if already present. If set to False, the migration workflow will wait for a confirmation, if it detects that the + * database already exists. + * + * @return the overwriteDbsInTarget value. + */ + public OverwriteDbsInTargetEnum overwriteDbsInTarget() { + return this.innerProperties() == null ? null : this.innerProperties().overwriteDbsInTarget(); + } + + /** + * Set the overwriteDbsInTarget property: Indicates whether the databases on the target server can be overwritten, + * if already present. If set to False, the migration workflow will wait for a confirmation, if it detects that the + * database already exists. + * + * @param overwriteDbsInTarget the overwriteDbsInTarget value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withOverwriteDbsInTarget(OverwriteDbsInTargetEnum overwriteDbsInTarget) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withOverwriteDbsInTarget(overwriteDbsInTarget); + return this; + } + + /** + * Get the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @return the migrationWindowStartTimeInUtc value. + */ + public OffsetDateTime migrationWindowStartTimeInUtc() { + return this.innerProperties() == null ? null : this.innerProperties().migrationWindowStartTimeInUtc(); + } + + /** + * Set the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @param migrationWindowStartTimeInUtc the migrationWindowStartTimeInUtc value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withMigrationWindowStartTimeInUtc(OffsetDateTime migrationWindowStartTimeInUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withMigrationWindowStartTimeInUtc(migrationWindowStartTimeInUtc); + return this; + } + + /** + * Get the migrationWindowEndTimeInUtc property: End time in UTC for migration window. + * + * @return the migrationWindowEndTimeInUtc value. + */ + public OffsetDateTime migrationWindowEndTimeInUtc() { + return this.innerProperties() == null ? null : this.innerProperties().migrationWindowEndTimeInUtc(); + } + + /** + * Set the migrationWindowEndTimeInUtc property: End time in UTC for migration window. + * + * @param migrationWindowEndTimeInUtc the migrationWindowEndTimeInUtc value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withMigrationWindowEndTimeInUtc(OffsetDateTime migrationWindowEndTimeInUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withMigrationWindowEndTimeInUtc(migrationWindowEndTimeInUtc); + return this; + } + + /** + * Get the startDataMigration property: Indicates whether the data migration should start right away. + * + * @return the startDataMigration value. + */ + public StartDataMigrationEnum startDataMigration() { + return this.innerProperties() == null ? null : this.innerProperties().startDataMigration(); + } + + /** + * Set the startDataMigration property: Indicates whether the data migration should start right away. + * + * @param startDataMigration the startDataMigration value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withStartDataMigration(StartDataMigrationEnum startDataMigration) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withStartDataMigration(startDataMigration); + return this; + } + + /** + * Get the triggerCutover property: To trigger cutover for entire migration we need to send this flag as True. + * + * @return the triggerCutover value. + */ + public TriggerCutoverEnum triggerCutover() { + return this.innerProperties() == null ? null : this.innerProperties().triggerCutover(); + } + + /** + * Set the triggerCutover property: To trigger cutover for entire migration we need to send this flag as True. + * + * @param triggerCutover the triggerCutover value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withTriggerCutover(TriggerCutoverEnum triggerCutover) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withTriggerCutover(triggerCutover); + return this; + } + + /** + * Get the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases send + * triggerCutover flag as True and database names in this array. + * + * @return the dbsToTriggerCutoverOn value. + */ + public List dbsToTriggerCutoverOn() { + return this.innerProperties() == null ? null : this.innerProperties().dbsToTriggerCutoverOn(); + } + + /** + * Set the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases send + * triggerCutover flag as True and database names in this array. + * + * @param dbsToTriggerCutoverOn the dbsToTriggerCutoverOn value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withDbsToTriggerCutoverOn(List dbsToTriggerCutoverOn) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withDbsToTriggerCutoverOn(dbsToTriggerCutoverOn); + return this; + } + + /** + * Get the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @return the cancel value. + */ + public CancelEnum cancel() { + return this.innerProperties() == null ? null : this.innerProperties().cancel(); + } + + /** + * Set the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @param cancel the cancel value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withCancel(CancelEnum cancel) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withCancel(cancel); + return this; + } + + /** + * Get the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases send cancel flag + * as True and database names in this array. + * + * @return the dbsToCancelMigrationOn value. + */ + public List dbsToCancelMigrationOn() { + return this.innerProperties() == null ? null : this.innerProperties().dbsToCancelMigrationOn(); + } + + /** + * Set the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases send cancel flag + * as True and database names in this array. + * + * @param dbsToCancelMigrationOn the dbsToCancelMigrationOn value to set. + * @return the MigrationResourceInner object itself. + */ + public MigrationResourceInner withDbsToCancelMigrationOn(List dbsToCancelMigrationOn) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourceProperties(); + } + this.innerProperties().withDbsToCancelMigrationOn(dbsToCancelMigrationOn); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationResourceProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationResourceProperties.java new file mode 100644 index 0000000000000..ab79f8fc84438 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationResourceProperties.java @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.models.CancelEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.DbServerMetadata; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogicalReplicationOnSourceDbEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationMode; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationSecretParameters; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationStatus; +import com.azure.resourcemanager.postgresqlflexibleserver.models.OverwriteDbsInTargetEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StartDataMigrationEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.TriggerCutoverEnum; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Migration resource properties. */ +@Fluent +public final class MigrationResourceProperties { + /* + * ID for migration, a GUID. + */ + @JsonProperty(value = "migrationId", access = JsonProperty.Access.WRITE_ONLY) + private String migrationId; + + /* + * Current status of migration + */ + @JsonProperty(value = "currentStatus", access = JsonProperty.Access.WRITE_ONLY) + private MigrationStatus currentStatus; + + /* + * There are two types of migration modes Online and Offline + */ + @JsonProperty(value = "migrationMode") + private MigrationMode migrationMode; + + /* + * Metadata of the source database server + */ + @JsonProperty(value = "sourceDbServerMetadata", access = JsonProperty.Access.WRITE_ONLY) + private DbServerMetadata sourceDbServerMetadata; + + /* + * Metadata of the target database server + */ + @JsonProperty(value = "targetDbServerMetadata", access = JsonProperty.Access.WRITE_ONLY) + private DbServerMetadata targetDbServerMetadata; + + /* + * ResourceId of the source database server + */ + @JsonProperty(value = "sourceDbServerResourceId") + private String sourceDbServerResourceId; + + /* + * Source server fully qualified domain name or ip. It is a optional value, if customer provide it, dms will always + * use it for connection + */ + @JsonProperty(value = "sourceDbServerFullyQualifiedDomainName") + private String sourceDbServerFullyQualifiedDomainName; + + /* + * ResourceId of the source database server + */ + @JsonProperty(value = "targetDbServerResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String targetDbServerResourceId; + + /* + * Target server fully qualified domain name or ip. It is a optional value, if customer provide it, dms will always + * use it for connection + */ + @JsonProperty(value = "targetDbServerFullyQualifiedDomainName") + private String targetDbServerFullyQualifiedDomainName; + + /* + * Migration secret parameters + */ + @JsonProperty(value = "secretParameters") + private MigrationSecretParameters secretParameters; + + /* + * Number of databases to migrate + */ + @JsonProperty(value = "dbsToMigrate") + private List dbsToMigrate; + + /* + * Indicates whether to setup LogicalReplicationOnSourceDb, if needed + */ + @JsonProperty(value = "setupLogicalReplicationOnSourceDbIfNeeded") + private LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded; + + /* + * Indicates whether the databases on the target server can be overwritten, if already present. If set to False, + * the migration workflow will wait for a confirmation, if it detects that the database already exists. + */ + @JsonProperty(value = "overwriteDbsInTarget") + private OverwriteDbsInTargetEnum overwriteDbsInTarget; + + /* + * Start time in UTC for migration window + */ + @JsonProperty(value = "migrationWindowStartTimeInUtc") + private OffsetDateTime migrationWindowStartTimeInUtc; + + /* + * End time in UTC for migration window + */ + @JsonProperty(value = "migrationWindowEndTimeInUtc") + private OffsetDateTime migrationWindowEndTimeInUtc; + + /* + * Indicates whether the data migration should start right away + */ + @JsonProperty(value = "startDataMigration") + private StartDataMigrationEnum startDataMigration; + + /* + * To trigger cutover for entire migration we need to send this flag as True + */ + @JsonProperty(value = "triggerCutover") + private TriggerCutoverEnum triggerCutover; + + /* + * When you want to trigger cutover for specific databases send triggerCutover flag as True and database names in + * this array + */ + @JsonProperty(value = "dbsToTriggerCutoverOn") + private List dbsToTriggerCutoverOn; + + /* + * To trigger cancel for entire migration we need to send this flag as True + */ + @JsonProperty(value = "cancel") + private CancelEnum cancel; + + /* + * When you want to trigger cancel for specific databases send cancel flag as True and database names in this array + */ + @JsonProperty(value = "dbsToCancelMigrationOn") + private List dbsToCancelMigrationOn; + + /** Creates an instance of MigrationResourceProperties class. */ + public MigrationResourceProperties() { + } + + /** + * Get the migrationId property: ID for migration, a GUID. + * + * @return the migrationId value. + */ + public String migrationId() { + return this.migrationId; + } + + /** + * Get the currentStatus property: Current status of migration. + * + * @return the currentStatus value. + */ + public MigrationStatus currentStatus() { + return this.currentStatus; + } + + /** + * Get the migrationMode property: There are two types of migration modes Online and Offline. + * + * @return the migrationMode value. + */ + public MigrationMode migrationMode() { + return this.migrationMode; + } + + /** + * Set the migrationMode property: There are two types of migration modes Online and Offline. + * + * @param migrationMode the migrationMode value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withMigrationMode(MigrationMode migrationMode) { + this.migrationMode = migrationMode; + return this; + } + + /** + * Get the sourceDbServerMetadata property: Metadata of the source database server. + * + * @return the sourceDbServerMetadata value. + */ + public DbServerMetadata sourceDbServerMetadata() { + return this.sourceDbServerMetadata; + } + + /** + * Get the targetDbServerMetadata property: Metadata of the target database server. + * + * @return the targetDbServerMetadata value. + */ + public DbServerMetadata targetDbServerMetadata() { + return this.targetDbServerMetadata; + } + + /** + * Get the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @return the sourceDbServerResourceId value. + */ + public String sourceDbServerResourceId() { + return this.sourceDbServerResourceId; + } + + /** + * Set the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @param sourceDbServerResourceId the sourceDbServerResourceId value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withSourceDbServerResourceId(String sourceDbServerResourceId) { + this.sourceDbServerResourceId = sourceDbServerResourceId; + return this; + } + + /** + * Get the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @return the sourceDbServerFullyQualifiedDomainName value. + */ + public String sourceDbServerFullyQualifiedDomainName() { + return this.sourceDbServerFullyQualifiedDomainName; + } + + /** + * Set the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @param sourceDbServerFullyQualifiedDomainName the sourceDbServerFullyQualifiedDomainName value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withSourceDbServerFullyQualifiedDomainName( + String sourceDbServerFullyQualifiedDomainName) { + this.sourceDbServerFullyQualifiedDomainName = sourceDbServerFullyQualifiedDomainName; + return this; + } + + /** + * Get the targetDbServerResourceId property: ResourceId of the source database server. + * + * @return the targetDbServerResourceId value. + */ + public String targetDbServerResourceId() { + return this.targetDbServerResourceId; + } + + /** + * Get the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @return the targetDbServerFullyQualifiedDomainName value. + */ + public String targetDbServerFullyQualifiedDomainName() { + return this.targetDbServerFullyQualifiedDomainName; + } + + /** + * Set the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @param targetDbServerFullyQualifiedDomainName the targetDbServerFullyQualifiedDomainName value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withTargetDbServerFullyQualifiedDomainName( + String targetDbServerFullyQualifiedDomainName) { + this.targetDbServerFullyQualifiedDomainName = targetDbServerFullyQualifiedDomainName; + return this; + } + + /** + * Get the secretParameters property: Migration secret parameters. + * + * @return the secretParameters value. + */ + public MigrationSecretParameters secretParameters() { + return this.secretParameters; + } + + /** + * Set the secretParameters property: Migration secret parameters. + * + * @param secretParameters the secretParameters value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withSecretParameters(MigrationSecretParameters secretParameters) { + this.secretParameters = secretParameters; + return this; + } + + /** + * Get the dbsToMigrate property: Number of databases to migrate. + * + * @return the dbsToMigrate value. + */ + public List dbsToMigrate() { + return this.dbsToMigrate; + } + + /** + * Set the dbsToMigrate property: Number of databases to migrate. + * + * @param dbsToMigrate the dbsToMigrate value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withDbsToMigrate(List dbsToMigrate) { + this.dbsToMigrate = dbsToMigrate; + return this; + } + + /** + * Get the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @return the setupLogicalReplicationOnSourceDbIfNeeded value. + */ + public LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded() { + return this.setupLogicalReplicationOnSourceDbIfNeeded; + } + + /** + * Set the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @param setupLogicalReplicationOnSourceDbIfNeeded the setupLogicalReplicationOnSourceDbIfNeeded value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withSetupLogicalReplicationOnSourceDbIfNeeded( + LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded) { + this.setupLogicalReplicationOnSourceDbIfNeeded = setupLogicalReplicationOnSourceDbIfNeeded; + return this; + } + + /** + * Get the overwriteDbsInTarget property: Indicates whether the databases on the target server can be overwritten, + * if already present. If set to False, the migration workflow will wait for a confirmation, if it detects that the + * database already exists. + * + * @return the overwriteDbsInTarget value. + */ + public OverwriteDbsInTargetEnum overwriteDbsInTarget() { + return this.overwriteDbsInTarget; + } + + /** + * Set the overwriteDbsInTarget property: Indicates whether the databases on the target server can be overwritten, + * if already present. If set to False, the migration workflow will wait for a confirmation, if it detects that the + * database already exists. + * + * @param overwriteDbsInTarget the overwriteDbsInTarget value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withOverwriteDbsInTarget(OverwriteDbsInTargetEnum overwriteDbsInTarget) { + this.overwriteDbsInTarget = overwriteDbsInTarget; + return this; + } + + /** + * Get the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @return the migrationWindowStartTimeInUtc value. + */ + public OffsetDateTime migrationWindowStartTimeInUtc() { + return this.migrationWindowStartTimeInUtc; + } + + /** + * Set the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @param migrationWindowStartTimeInUtc the migrationWindowStartTimeInUtc value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withMigrationWindowStartTimeInUtc(OffsetDateTime migrationWindowStartTimeInUtc) { + this.migrationWindowStartTimeInUtc = migrationWindowStartTimeInUtc; + return this; + } + + /** + * Get the migrationWindowEndTimeInUtc property: End time in UTC for migration window. + * + * @return the migrationWindowEndTimeInUtc value. + */ + public OffsetDateTime migrationWindowEndTimeInUtc() { + return this.migrationWindowEndTimeInUtc; + } + + /** + * Set the migrationWindowEndTimeInUtc property: End time in UTC for migration window. + * + * @param migrationWindowEndTimeInUtc the migrationWindowEndTimeInUtc value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withMigrationWindowEndTimeInUtc(OffsetDateTime migrationWindowEndTimeInUtc) { + this.migrationWindowEndTimeInUtc = migrationWindowEndTimeInUtc; + return this; + } + + /** + * Get the startDataMigration property: Indicates whether the data migration should start right away. + * + * @return the startDataMigration value. + */ + public StartDataMigrationEnum startDataMigration() { + return this.startDataMigration; + } + + /** + * Set the startDataMigration property: Indicates whether the data migration should start right away. + * + * @param startDataMigration the startDataMigration value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withStartDataMigration(StartDataMigrationEnum startDataMigration) { + this.startDataMigration = startDataMigration; + return this; + } + + /** + * Get the triggerCutover property: To trigger cutover for entire migration we need to send this flag as True. + * + * @return the triggerCutover value. + */ + public TriggerCutoverEnum triggerCutover() { + return this.triggerCutover; + } + + /** + * Set the triggerCutover property: To trigger cutover for entire migration we need to send this flag as True. + * + * @param triggerCutover the triggerCutover value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withTriggerCutover(TriggerCutoverEnum triggerCutover) { + this.triggerCutover = triggerCutover; + return this; + } + + /** + * Get the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases send + * triggerCutover flag as True and database names in this array. + * + * @return the dbsToTriggerCutoverOn value. + */ + public List dbsToTriggerCutoverOn() { + return this.dbsToTriggerCutoverOn; + } + + /** + * Set the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases send + * triggerCutover flag as True and database names in this array. + * + * @param dbsToTriggerCutoverOn the dbsToTriggerCutoverOn value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withDbsToTriggerCutoverOn(List dbsToTriggerCutoverOn) { + this.dbsToTriggerCutoverOn = dbsToTriggerCutoverOn; + return this; + } + + /** + * Get the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @return the cancel value. + */ + public CancelEnum cancel() { + return this.cancel; + } + + /** + * Set the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @param cancel the cancel value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withCancel(CancelEnum cancel) { + this.cancel = cancel; + return this; + } + + /** + * Get the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases send cancel flag + * as True and database names in this array. + * + * @return the dbsToCancelMigrationOn value. + */ + public List dbsToCancelMigrationOn() { + return this.dbsToCancelMigrationOn; + } + + /** + * Set the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases send cancel flag + * as True and database names in this array. + * + * @param dbsToCancelMigrationOn the dbsToCancelMigrationOn value to set. + * @return the MigrationResourceProperties object itself. + */ + public MigrationResourceProperties withDbsToCancelMigrationOn(List dbsToCancelMigrationOn) { + this.dbsToCancelMigrationOn = dbsToCancelMigrationOn; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentStatus() != null) { + currentStatus().validate(); + } + if (sourceDbServerMetadata() != null) { + sourceDbServerMetadata().validate(); + } + if (targetDbServerMetadata() != null) { + targetDbServerMetadata().validate(); + } + if (secretParameters() != null) { + secretParameters().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationResourcePropertiesForPatch.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationResourcePropertiesForPatch.java new file mode 100644 index 0000000000000..978b1cc4a3249 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/MigrationResourcePropertiesForPatch.java @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.models.CancelEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogicalReplicationOnSourceDbEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationMode; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationSecretParameters; +import com.azure.resourcemanager.postgresqlflexibleserver.models.OverwriteDbsInTargetEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StartDataMigrationEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.TriggerCutoverEnum; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Migration resource properties for patch. */ +@Fluent +public final class MigrationResourcePropertiesForPatch { + /* + * ResourceId of the source database server + */ + @JsonProperty(value = "sourceDbServerResourceId") + private String sourceDbServerResourceId; + + /* + * Source server fully qualified domain name or ip. It is a optional value, if customer provide it, dms will always + * use it for connection + */ + @JsonProperty(value = "sourceDbServerFullyQualifiedDomainName") + private String sourceDbServerFullyQualifiedDomainName; + + /* + * Target server fully qualified domain name or ip. It is a optional value, if customer provide it, dms will always + * use it for connection + */ + @JsonProperty(value = "targetDbServerFullyQualifiedDomainName") + private String targetDbServerFullyQualifiedDomainName; + + /* + * Migration secret parameters + */ + @JsonProperty(value = "secretParameters") + private MigrationSecretParameters secretParameters; + + /* + * Number of databases to migrate + */ + @JsonProperty(value = "dbsToMigrate") + private List dbsToMigrate; + + /* + * Indicates whether to setup LogicalReplicationOnSourceDb, if needed + */ + @JsonProperty(value = "setupLogicalReplicationOnSourceDbIfNeeded") + private LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded; + + /* + * Indicates whether the databases on the target server can be overwritten, if already present. If set to False, + * the migration workflow will wait for a confirmation, if it detects that the database already exists. + */ + @JsonProperty(value = "overwriteDbsInTarget") + private OverwriteDbsInTargetEnum overwriteDbsInTarget; + + /* + * Start time in UTC for migration window + */ + @JsonProperty(value = "migrationWindowStartTimeInUtc") + private OffsetDateTime migrationWindowStartTimeInUtc; + + /* + * Indicates whether the data migration should start right away + */ + @JsonProperty(value = "startDataMigration") + private StartDataMigrationEnum startDataMigration; + + /* + * To trigger cutover for entire migration we need to send this flag as True + */ + @JsonProperty(value = "triggerCutover") + private TriggerCutoverEnum triggerCutover; + + /* + * When you want to trigger cutover for specific databases send triggerCutover flag as True and database names in + * this array + */ + @JsonProperty(value = "dbsToTriggerCutoverOn") + private List dbsToTriggerCutoverOn; + + /* + * To trigger cancel for entire migration we need to send this flag as True + */ + @JsonProperty(value = "cancel") + private CancelEnum cancel; + + /* + * When you want to trigger cancel for specific databases send cancel flag as True and database names in this array + */ + @JsonProperty(value = "dbsToCancelMigrationOn") + private List dbsToCancelMigrationOn; + + /* + * There are two types of migration modes Online and Offline + */ + @JsonProperty(value = "migrationMode") + private MigrationMode migrationMode; + + /** Creates an instance of MigrationResourcePropertiesForPatch class. */ + public MigrationResourcePropertiesForPatch() { + } + + /** + * Get the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @return the sourceDbServerResourceId value. + */ + public String sourceDbServerResourceId() { + return this.sourceDbServerResourceId; + } + + /** + * Set the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @param sourceDbServerResourceId the sourceDbServerResourceId value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withSourceDbServerResourceId(String sourceDbServerResourceId) { + this.sourceDbServerResourceId = sourceDbServerResourceId; + return this; + } + + /** + * Get the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @return the sourceDbServerFullyQualifiedDomainName value. + */ + public String sourceDbServerFullyQualifiedDomainName() { + return this.sourceDbServerFullyQualifiedDomainName; + } + + /** + * Set the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @param sourceDbServerFullyQualifiedDomainName the sourceDbServerFullyQualifiedDomainName value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withSourceDbServerFullyQualifiedDomainName( + String sourceDbServerFullyQualifiedDomainName) { + this.sourceDbServerFullyQualifiedDomainName = sourceDbServerFullyQualifiedDomainName; + return this; + } + + /** + * Get the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @return the targetDbServerFullyQualifiedDomainName value. + */ + public String targetDbServerFullyQualifiedDomainName() { + return this.targetDbServerFullyQualifiedDomainName; + } + + /** + * Set the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @param targetDbServerFullyQualifiedDomainName the targetDbServerFullyQualifiedDomainName value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withTargetDbServerFullyQualifiedDomainName( + String targetDbServerFullyQualifiedDomainName) { + this.targetDbServerFullyQualifiedDomainName = targetDbServerFullyQualifiedDomainName; + return this; + } + + /** + * Get the secretParameters property: Migration secret parameters. + * + * @return the secretParameters value. + */ + public MigrationSecretParameters secretParameters() { + return this.secretParameters; + } + + /** + * Set the secretParameters property: Migration secret parameters. + * + * @param secretParameters the secretParameters value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withSecretParameters(MigrationSecretParameters secretParameters) { + this.secretParameters = secretParameters; + return this; + } + + /** + * Get the dbsToMigrate property: Number of databases to migrate. + * + * @return the dbsToMigrate value. + */ + public List dbsToMigrate() { + return this.dbsToMigrate; + } + + /** + * Set the dbsToMigrate property: Number of databases to migrate. + * + * @param dbsToMigrate the dbsToMigrate value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withDbsToMigrate(List dbsToMigrate) { + this.dbsToMigrate = dbsToMigrate; + return this; + } + + /** + * Get the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @return the setupLogicalReplicationOnSourceDbIfNeeded value. + */ + public LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded() { + return this.setupLogicalReplicationOnSourceDbIfNeeded; + } + + /** + * Set the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @param setupLogicalReplicationOnSourceDbIfNeeded the setupLogicalReplicationOnSourceDbIfNeeded value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withSetupLogicalReplicationOnSourceDbIfNeeded( + LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded) { + this.setupLogicalReplicationOnSourceDbIfNeeded = setupLogicalReplicationOnSourceDbIfNeeded; + return this; + } + + /** + * Get the overwriteDbsInTarget property: Indicates whether the databases on the target server can be overwritten, + * if already present. If set to False, the migration workflow will wait for a confirmation, if it detects that the + * database already exists. + * + * @return the overwriteDbsInTarget value. + */ + public OverwriteDbsInTargetEnum overwriteDbsInTarget() { + return this.overwriteDbsInTarget; + } + + /** + * Set the overwriteDbsInTarget property: Indicates whether the databases on the target server can be overwritten, + * if already present. If set to False, the migration workflow will wait for a confirmation, if it detects that the + * database already exists. + * + * @param overwriteDbsInTarget the overwriteDbsInTarget value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withOverwriteDbsInTarget(OverwriteDbsInTargetEnum overwriteDbsInTarget) { + this.overwriteDbsInTarget = overwriteDbsInTarget; + return this; + } + + /** + * Get the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @return the migrationWindowStartTimeInUtc value. + */ + public OffsetDateTime migrationWindowStartTimeInUtc() { + return this.migrationWindowStartTimeInUtc; + } + + /** + * Set the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @param migrationWindowStartTimeInUtc the migrationWindowStartTimeInUtc value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withMigrationWindowStartTimeInUtc( + OffsetDateTime migrationWindowStartTimeInUtc) { + this.migrationWindowStartTimeInUtc = migrationWindowStartTimeInUtc; + return this; + } + + /** + * Get the startDataMigration property: Indicates whether the data migration should start right away. + * + * @return the startDataMigration value. + */ + public StartDataMigrationEnum startDataMigration() { + return this.startDataMigration; + } + + /** + * Set the startDataMigration property: Indicates whether the data migration should start right away. + * + * @param startDataMigration the startDataMigration value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withStartDataMigration(StartDataMigrationEnum startDataMigration) { + this.startDataMigration = startDataMigration; + return this; + } + + /** + * Get the triggerCutover property: To trigger cutover for entire migration we need to send this flag as True. + * + * @return the triggerCutover value. + */ + public TriggerCutoverEnum triggerCutover() { + return this.triggerCutover; + } + + /** + * Set the triggerCutover property: To trigger cutover for entire migration we need to send this flag as True. + * + * @param triggerCutover the triggerCutover value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withTriggerCutover(TriggerCutoverEnum triggerCutover) { + this.triggerCutover = triggerCutover; + return this; + } + + /** + * Get the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases send + * triggerCutover flag as True and database names in this array. + * + * @return the dbsToTriggerCutoverOn value. + */ + public List dbsToTriggerCutoverOn() { + return this.dbsToTriggerCutoverOn; + } + + /** + * Set the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases send + * triggerCutover flag as True and database names in this array. + * + * @param dbsToTriggerCutoverOn the dbsToTriggerCutoverOn value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withDbsToTriggerCutoverOn(List dbsToTriggerCutoverOn) { + this.dbsToTriggerCutoverOn = dbsToTriggerCutoverOn; + return this; + } + + /** + * Get the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @return the cancel value. + */ + public CancelEnum cancel() { + return this.cancel; + } + + /** + * Set the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @param cancel the cancel value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withCancel(CancelEnum cancel) { + this.cancel = cancel; + return this; + } + + /** + * Get the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases send cancel flag + * as True and database names in this array. + * + * @return the dbsToCancelMigrationOn value. + */ + public List dbsToCancelMigrationOn() { + return this.dbsToCancelMigrationOn; + } + + /** + * Set the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases send cancel flag + * as True and database names in this array. + * + * @param dbsToCancelMigrationOn the dbsToCancelMigrationOn value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withDbsToCancelMigrationOn(List dbsToCancelMigrationOn) { + this.dbsToCancelMigrationOn = dbsToCancelMigrationOn; + return this; + } + + /** + * Get the migrationMode property: There are two types of migration modes Online and Offline. + * + * @return the migrationMode value. + */ + public MigrationMode migrationMode() { + return this.migrationMode; + } + + /** + * Set the migrationMode property: There are two types of migration modes Online and Offline. + * + * @param migrationMode the migrationMode value to set. + * @return the MigrationResourcePropertiesForPatch object itself. + */ + public MigrationResourcePropertiesForPatch withMigrationMode(MigrationMode migrationMode) { + this.migrationMode = migrationMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (secretParameters() != null) { + secretParameters().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java index 3fc6de6cf5bdf..86949fa7ef2a5 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java @@ -318,7 +318,8 @@ public ServerInner withBackup(Backup backup) { } /** - * Get the network property: Network properties of a server. + * Get the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. * * @return the network value. */ @@ -327,7 +328,8 @@ public Network network() { } /** - * Set the network property: Network properties of a server. + * Set the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. * * @param network the network value to set. * @return the ServerInner object itself. @@ -388,7 +390,8 @@ public ServerInner withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { /** * Get the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This property is returned + * only for Replica server. * * @return the sourceServerResourceId value. */ @@ -398,7 +401,8 @@ public String sourceServerResourceId() { /** * Set the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This property is returned + * only for Replica server. * * @param sourceServerResourceId the sourceServerResourceId value to set. * @return the ServerInner object itself. @@ -413,7 +417,7 @@ public ServerInner withSourceServerResourceId(String sourceServerResourceId) { /** * Get the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'ReviveDropped'. * * @return the pointInTimeUtc value. */ @@ -423,7 +427,7 @@ public OffsetDateTime pointInTimeUtc() { /** * Set the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'ReviveDropped'. * * @param pointInTimeUtc the pointInTimeUtc value to set. * @return the ServerInner object itself. @@ -491,20 +495,6 @@ public Integer replicaCapacity() { return this.innerProperties() == null ? null : this.innerProperties().replicaCapacity(); } - /** - * Set the replicaCapacity property: Replicas allowed for a server. - * - * @param replicaCapacity the replicaCapacity value to set. - * @return the ServerInner object itself. - */ - public ServerInner withReplicaCapacity(Integer replicaCapacity) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerProperties(); - } - this.innerProperties().withReplicaCapacity(replicaCapacity); - return this; - } - /** * Get the createMode property: The mode to create a new PostgreSQL server. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerProperties.java index 95c1173a3b90c..13064d51ee9f7 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerProperties.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerProperties.java @@ -84,7 +84,8 @@ public final class ServerProperties { private Backup backup; /* - * Network properties of a server. + * Network properties of a server. This Network property is required to be passed only in case you want the server + * to be Private access server. */ @JsonProperty(value = "network") private Network network; @@ -103,14 +104,14 @@ public final class ServerProperties { /* * The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore' or - * 'GeoRestore' or 'Replica'. + * 'GeoRestore' or 'Replica' or 'ReviveDropped'. This property is returned only for Replica server */ @JsonProperty(value = "sourceServerResourceId") private String sourceServerResourceId; /* * Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when - * 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'ReviveDropped'. */ @JsonProperty(value = "pointInTimeUTC") private OffsetDateTime pointInTimeUtc; @@ -130,7 +131,7 @@ public final class ServerProperties { /* * Replicas allowed for a server. */ - @JsonProperty(value = "replicaCapacity") + @JsonProperty(value = "replicaCapacity", access = JsonProperty.Access.WRITE_ONLY) private Integer replicaCapacity; /* @@ -313,7 +314,8 @@ public ServerProperties withBackup(Backup backup) { } /** - * Get the network property: Network properties of a server. + * Get the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. * * @return the network value. */ @@ -322,7 +324,8 @@ public Network network() { } /** - * Set the network property: Network properties of a server. + * Set the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. * * @param network the network value to set. * @return the ServerProperties object itself. @@ -374,7 +377,8 @@ public ServerProperties withMaintenanceWindow(MaintenanceWindow maintenanceWindo /** * Get the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This property is returned + * only for Replica server. * * @return the sourceServerResourceId value. */ @@ -384,7 +388,8 @@ public String sourceServerResourceId() { /** * Set the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This property is returned + * only for Replica server. * * @param sourceServerResourceId the sourceServerResourceId value to set. * @return the ServerProperties object itself. @@ -396,7 +401,7 @@ public ServerProperties withSourceServerResourceId(String sourceServerResourceId /** * Get the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'ReviveDropped'. * * @return the pointInTimeUtc value. */ @@ -406,7 +411,7 @@ public OffsetDateTime pointInTimeUtc() { /** * Set the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'ReviveDropped'. * * @param pointInTimeUtc the pointInTimeUtc value to set. * @return the ServerProperties object itself. @@ -465,17 +470,6 @@ public Integer replicaCapacity() { return this.replicaCapacity; } - /** - * Set the replicaCapacity property: Replicas allowed for a server. - * - * @param replicaCapacity the replicaCapacity value to set. - * @return the ServerProperties object itself. - */ - public ServerProperties withReplicaCapacity(Integer replicaCapacity) { - this.replicaCapacity = replicaCapacity; - return this; - } - /** * Get the createMode property: The mode to create a new PostgreSQL server. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java index 47db10fbfcee9..0d1e315707ae0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java @@ -11,6 +11,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption; import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Network; import com.azure.resourcemanager.postgresqlflexibleserver.models.ReplicationRole; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; @@ -79,6 +80,13 @@ public final class ServerPropertiesForUpdate { @JsonProperty(value = "replicationRole") private ReplicationRole replicationRole; + /* + * Network properties of a server. These are required to be passed only in case if server is a private access + * server. + */ + @JsonProperty(value = "network") + private Network network; + /** Creates an instance of ServerPropertiesForUpdate class. */ public ServerPropertiesForUpdate() { } @@ -283,6 +291,28 @@ public ServerPropertiesForUpdate withReplicationRole(ReplicationRole replication return this; } + /** + * Get the network property: Network properties of a server. These are required to be passed only in case if server + * is a private access server. + * + * @return the network value. + */ + public Network network() { + return this.network; + } + + /** + * Set the network property: Network properties of a server. These are required to be passed only in case if server + * is a private access server. + * + * @param network the network value to set. + * @return the ServerPropertiesForUpdate object itself. + */ + public ServerPropertiesForUpdate withNetwork(Network network) { + this.network = network; + return this; + } + /** * Validates the instance. * @@ -307,5 +337,8 @@ public void validate() { if (dataEncryption() != null) { dataEncryption().validate(); } + if (network() != null) { + network().validate(); + } } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FlexibleServerCapabilityImpl.java similarity index 50% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FlexibleServerCapabilityImpl.java index 4698faa775da3..baf6aa401c2d2 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FlexibleServerCapabilityImpl.java @@ -4,53 +4,48 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilityProperties; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilityStatus; import com.azure.resourcemanager.postgresqlflexibleserver.models.FastProvisioningEditionCapability; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FastProvisioningSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerCapability; import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerEditionCapability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HyperscaleNodeEditionCapability; +import com.azure.resourcemanager.postgresqlflexibleserver.models.GeoBackupSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.OnlineResizeSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RestrictedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersionCapability; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrowthSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ZoneRedundantHaAndGeoBackupSupportedEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ZoneRedundantHaSupportedEnum; import java.util.Collections; import java.util.List; -public final class CapabilityPropertiesImpl implements CapabilityProperties { - private CapabilityPropertiesInner innerObject; +public final class FlexibleServerCapabilityImpl implements FlexibleServerCapability { + private FlexibleServerCapabilityInner innerObject; private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - CapabilityPropertiesImpl( - CapabilityPropertiesInner innerObject, + FlexibleServerCapabilityImpl( + FlexibleServerCapabilityInner innerObject, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } - public String zone() { - return this.innerModel().zone(); - } - - public List supportedHAMode() { - List inner = this.innerModel().supportedHAMode(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } + public CapabilityStatus status() { + return this.innerModel().status(); } - public Boolean geoBackupSupported() { - return this.innerModel().geoBackupSupported(); + public String reason() { + return this.innerModel().reason(); } - public Boolean zoneRedundantHaSupported() { - return this.innerModel().zoneRedundantHaSupported(); + public String name() { + return this.innerModel().name(); } - public Boolean zoneRedundantHaAndGeoBackupSupported() { - return this.innerModel().zoneRedundantHaAndGeoBackupSupported(); - } - - public List supportedFlexibleServerEditions() { - List inner = this.innerModel().supportedFlexibleServerEditions(); + public List supportedServerEditions() { + List inner = this.innerModel().supportedServerEditions(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -58,8 +53,8 @@ public List supportedFlexibleServerEditions() { } } - public List supportedHyperscaleNodeEditions() { - List inner = this.innerModel().supportedHyperscaleNodeEditions(); + public List supportedServerVersions() { + List inner = this.innerModel().supportedServerVersions(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -67,7 +62,7 @@ public List supportedHyperscaleNodeEditions() { } } - public Boolean fastProvisioningSupported() { + public FastProvisioningSupportedEnum fastProvisioningSupported() { return this.innerModel().fastProvisioningSupported(); } @@ -80,11 +75,31 @@ public List supportedFastProvisioningEditions } } - public String status() { - return this.innerModel().status(); + public GeoBackupSupportedEnum geoBackupSupported() { + return this.innerModel().geoBackupSupported(); + } + + public ZoneRedundantHaSupportedEnum zoneRedundantHaSupported() { + return this.innerModel().zoneRedundantHaSupported(); + } + + public ZoneRedundantHaAndGeoBackupSupportedEnum zoneRedundantHaAndGeoBackupSupported() { + return this.innerModel().zoneRedundantHaAndGeoBackupSupported(); + } + + public StorageAutoGrowthSupportedEnum storageAutoGrowthSupported() { + return this.innerModel().storageAutoGrowthSupported(); + } + + public OnlineResizeSupportedEnum onlineResizeSupported() { + return this.innerModel().onlineResizeSupported(); + } + + public RestrictedEnum restricted() { + return this.innerModel().restricted(); } - public CapabilityPropertiesInner innerModel() { + public FlexibleServerCapabilityInner innerModel() { return this.innerObject; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FlexibleServersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FlexibleServersClientImpl.java new file mode 100644 index 0000000000000..5d05bac0cfc63 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FlexibleServersClientImpl.java @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.FlexibleServersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrBackupResponseInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrPreBackupResponseInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServersTriggerLtrPreBackupResponse; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrBackupRequest; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrPreBackupRequest; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FlexibleServersClient. */ +public final class FlexibleServersClientImpl implements FlexibleServersClient { + /** The proxy service used to perform REST calls. */ + private final FlexibleServersService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of FlexibleServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FlexibleServersClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(FlexibleServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientFlexibleServers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface FlexibleServersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrPreBackup") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono triggerLtrPreBackup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") LtrPreBackupRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/startLtrBackup") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> startLtrBackup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") LtrBackupRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR pre-backup API call on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono triggerLtrPreBackupWithResponseAsync( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .triggerLtrPreBackup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR pre-backup API call on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerLtrPreBackupWithResponseAsync( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .triggerLtrPreBackup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context); + } + + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR pre-backup API call on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono triggerLtrPreBackupAsync( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters) { + return triggerLtrPreBackupWithResponseAsync(resourceGroupName, serverName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR pre-backup API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FlexibleServersTriggerLtrPreBackupResponse triggerLtrPreBackupWithResponse( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters, Context context) { + return triggerLtrPreBackupWithResponseAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR pre-backup API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LtrPreBackupResponseInner triggerLtrPreBackup( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters) { + return triggerLtrPreBackupWithResponse(resourceGroupName, serverName, parameters, Context.NONE).getValue(); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> startLtrBackupWithResponseAsync( + String resourceGroupName, String serverName, LtrBackupRequest parameters) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .startLtrBackup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR backup API call along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startLtrBackupWithResponseAsync( + String resourceGroupName, String serverName, LtrBackupRequest parameters, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .startLtrBackup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, LtrBackupResponseInner> beginStartLtrBackupAsync( + String resourceGroupName, String serverName, LtrBackupRequest parameters) { + Mono>> mono = + startLtrBackupWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LtrBackupResponseInner.class, + LtrBackupResponseInner.class, + this.client.getContext()); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LtrBackupResponseInner> beginStartLtrBackupAsync( + String resourceGroupName, String serverName, LtrBackupRequest parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startLtrBackupWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LtrBackupResponseInner.class, + LtrBackupResponseInner.class, + context); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LtrBackupResponseInner> beginStartLtrBackup( + String resourceGroupName, String serverName, LtrBackupRequest parameters) { + return this.beginStartLtrBackupAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LtrBackupResponseInner> beginStartLtrBackup( + String resourceGroupName, String serverName, LtrBackupRequest parameters, Context context) { + return this.beginStartLtrBackupAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono startLtrBackupAsync( + String resourceGroupName, String serverName, LtrBackupRequest parameters) { + return beginStartLtrBackupAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR backup API call on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startLtrBackupAsync( + String resourceGroupName, String serverName, LtrBackupRequest parameters, Context context) { + return beginStartLtrBackupAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LtrBackupResponseInner startLtrBackup( + String resourceGroupName, String serverName, LtrBackupRequest parameters) { + return startLtrBackupAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR backup API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LtrBackupResponseInner startLtrBackup( + String resourceGroupName, String serverName, LtrBackupRequest parameters, Context context) { + return startLtrBackupAsync(resourceGroupName, serverName, parameters, context).block(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FlexibleServersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FlexibleServersImpl.java new file mode 100644 index 0000000000000..db85a88f9734e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FlexibleServersImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.FlexibleServersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrBackupResponseInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrPreBackupResponseInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServers; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServersTriggerLtrPreBackupResponse; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrBackupRequest; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrBackupResponse; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrPreBackupRequest; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrPreBackupResponse; + +public final class FlexibleServersImpl implements FlexibleServers { + private static final ClientLogger LOGGER = new ClientLogger(FlexibleServersImpl.class); + + private final FlexibleServersClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public FlexibleServersImpl( + FlexibleServersClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response triggerLtrPreBackupWithResponse( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters, Context context) { + FlexibleServersTriggerLtrPreBackupResponse inner = + this.serviceClient().triggerLtrPreBackupWithResponse(resourceGroupName, serverName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LtrPreBackupResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LtrPreBackupResponse triggerLtrPreBackup( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters) { + LtrPreBackupResponseInner inner = + this.serviceClient().triggerLtrPreBackup(resourceGroupName, serverName, parameters); + if (inner != null) { + return new LtrPreBackupResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public LtrBackupResponse startLtrBackup(String resourceGroupName, String serverName, LtrBackupRequest parameters) { + LtrBackupResponseInner inner = this.serviceClient().startLtrBackup(resourceGroupName, serverName, parameters); + if (inner != null) { + return new LtrBackupResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public LtrBackupResponse startLtrBackup( + String resourceGroupName, String serverName, LtrBackupRequest parameters, Context context) { + LtrBackupResponseInner inner = + this.serviceClient().startLtrBackup(resourceGroupName, serverName, parameters, context); + if (inner != null) { + return new LtrBackupResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private FlexibleServersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java index 1d3556eb07ea6..e3af7907c2eba 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java @@ -26,7 +26,7 @@ import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilitiesListResult; import reactor.core.publisher.Mono; @@ -93,7 +93,7 @@ Mono> executeNext( * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeSinglePageAsync(String locationName) { + private Mono> executeSinglePageAsync(String locationName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -121,7 +121,7 @@ private Mono> executeSinglePageAsync(St locationName, accept, context)) - .>map( + .>map( res -> new PagedResponseBase<>( res.getRequest(), @@ -145,7 +145,7 @@ private Mono> executeSinglePageAsync(St * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeSinglePageAsync( + private Mono> executeSinglePageAsync( String locationName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -193,7 +193,7 @@ private Mono> executeSinglePageAsync( * @return capabilities at specified location in a given subscription as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux executeAsync(String locationName) { + public PagedFlux executeAsync(String locationName) { return new PagedFlux<>( () -> executeSinglePageAsync(locationName), nextLink -> executeNextSinglePageAsync(nextLink)); } @@ -209,7 +209,7 @@ public PagedFlux executeAsync(String locationName) { * @return capabilities at specified location in a given subscription as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux executeAsync(String locationName, Context context) { + private PagedFlux executeAsync(String locationName, Context context) { return new PagedFlux<>( () -> executeSinglePageAsync(locationName, context), nextLink -> executeNextSinglePageAsync(nextLink, context)); @@ -226,7 +226,7 @@ private PagedFlux executeAsync(String locationName, C * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable execute(String locationName) { + public PagedIterable execute(String locationName) { return new PagedIterable<>(executeAsync(locationName)); } @@ -242,7 +242,7 @@ public PagedIterable execute(String locationName) { * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable execute(String locationName, Context context) { + public PagedIterable execute(String locationName, Context context) { return new PagedIterable<>(executeAsync(locationName, context)); } @@ -254,10 +254,11 @@ public PagedIterable execute(String locationName, Con * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return location capability along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return capability for the PostgreSQL server along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeNextSinglePageAsync(String nextLink) { + private Mono> executeNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -270,7 +271,7 @@ private Mono> executeNextSinglePageAsyn final String accept = "application/json"; return FluxUtil .withContext(context -> service.executeNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( + .>map( res -> new PagedResponseBase<>( res.getRequest(), @@ -291,10 +292,11 @@ private Mono> executeNextSinglePageAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return location capability along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return capability for the PostgreSQL server along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeNextSinglePageAsync( + private Mono> executeNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java index ea794b02808bb..f05bef6bedf84 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java @@ -8,8 +8,8 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilityProperties; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerCapability; import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedCapabilities; public final class LocationBasedCapabilitiesImpl implements LocationBasedCapabilities { @@ -26,14 +26,14 @@ public LocationBasedCapabilitiesImpl( this.serviceManager = serviceManager; } - public PagedIterable execute(String locationName) { - PagedIterable inner = this.serviceClient().execute(locationName); - return Utils.mapPage(inner, inner1 -> new CapabilityPropertiesImpl(inner1, this.manager())); + public PagedIterable execute(String locationName) { + PagedIterable inner = this.serviceClient().execute(locationName); + return Utils.mapPage(inner, inner1 -> new FlexibleServerCapabilityImpl(inner1, this.manager())); } - public PagedIterable execute(String locationName, Context context) { - PagedIterable inner = this.serviceClient().execute(locationName, context); - return Utils.mapPage(inner, inner1 -> new CapabilityPropertiesImpl(inner1, this.manager())); + public PagedIterable execute(String locationName, Context context) { + PagedIterable inner = this.serviceClient().execute(locationName, context); + return Utils.mapPage(inner, inner1 -> new FlexibleServerCapabilityImpl(inner1, this.manager())); } private LocationBasedCapabilitiesClient serviceClient() { diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFileImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFileImpl.java new file mode 100644 index 0000000000000..972c57d60e67b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFileImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFile; +import java.time.OffsetDateTime; + +public final class LogFileImpl implements LogFile { + private LogFileInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + LogFileImpl( + LogFileInner innerObject, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); + } + + public OffsetDateTime lastModifiedTime() { + return this.innerModel().lastModifiedTime(); + } + + public Long sizeInKb() { + return this.innerModel().sizeInKb(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String url() { + return this.innerModel().url(); + } + + public LogFileInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesClientImpl.java new file mode 100644 index 0000000000000..f6f737caa3cb3 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesClientImpl.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.fluent.LogFilesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFileListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +public final class LogFilesClientImpl implements LogFilesClient { + /** The proxy service used to perform REST calls. */ + private final LogFilesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of LogFilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LogFilesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = RestProxy.create(LogFilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientLogFiles to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface LogFilesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/logFiles") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync(String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + 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 server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesImpl.java new file mode 100644 index 0000000000000..5395cb92d9939 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.fluent.LogFilesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFile; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFiles; + +public final class LogFilesImpl implements LogFiles { + private static final ClientLogger LOGGER = new ClientLogger(LogFilesImpl.class); + + private final LogFilesClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public LogFilesImpl( + LogFilesClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager())); + } + + private LogFilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrBackupOperationsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrBackupOperationsClientImpl.java new file mode 100644 index 0000000000000..3321070348805 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrBackupOperationsClientImpl.java @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.fluent.LtrBackupOperationsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrServerBackupOperationInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrServerBackupOperationList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LtrBackupOperationsClient. */ +public final class LtrBackupOperationsClientImpl implements LtrBackupOperationsClient { + /** The proxy service used to perform REST calls. */ + private final LtrBackupOperationsService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of LtrBackupOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LtrBackupOperationsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(LtrBackupOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientLtrBackupOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface LtrBackupOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("backupName") String backupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the give long term retention backup operation for the flexible server along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String backupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + backupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @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 result of the give long term retention backup operation for the flexible server along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String backupName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + backupName, + accept, + context); + } + + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the give long term retention backup operation for the flexible server on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String serverName, String backupName) { + return getWithResponseAsync(resourceGroupName, serverName, backupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @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 result of the give long term retention backup operation for the flexible server along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String backupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, backupName, context).block(); + } + + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the give long term retention backup operation for the flexible server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LtrServerBackupOperationInner get(String resourceGroupName, String serverName, String backupName) { + return getWithResponse(resourceGroupName, serverName, backupName, Context.NONE).getValue(); + } + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the give long term retention backup operations for the flexible server along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + 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())); + } + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 result of the give long term retention backup operations for the flexible server along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the give long term retention backup operations for the flexible server as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 result of the give long term retention backup operations for the flexible server as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of the give long term retention backup operations for the flexible server as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 result of the give long term retention backup operations for the flexible server as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backup operations for server along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backup operations for server along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrBackupOperationsImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrBackupOperationsImpl.java new file mode 100644 index 0000000000000..e5f797dcfb7ac --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrBackupOperationsImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LtrBackupOperationsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrServerBackupOperationInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrBackupOperations; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrServerBackupOperation; + +public final class LtrBackupOperationsImpl implements LtrBackupOperations { + private static final ClientLogger LOGGER = new ClientLogger(LtrBackupOperationsImpl.class); + + private final LtrBackupOperationsClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public LtrBackupOperationsImpl( + LtrBackupOperationsClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String backupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, backupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LtrServerBackupOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LtrServerBackupOperation get(String resourceGroupName, String serverName, String backupName) { + LtrServerBackupOperationInner inner = this.serviceClient().get(resourceGroupName, serverName, backupName); + if (inner != null) { + return new LtrServerBackupOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new LtrServerBackupOperationImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new LtrServerBackupOperationImpl(inner1, this.manager())); + } + + private LtrBackupOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrBackupResponseImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrBackupResponseImpl.java new file mode 100644 index 0000000000000..f83d22134bb32 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrBackupResponseImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrBackupResponseInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ExecutionStatus; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrBackupResponse; +import java.time.OffsetDateTime; + +public final class LtrBackupResponseImpl implements LtrBackupResponse { + private LtrBackupResponseInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + LtrBackupResponseImpl( + LtrBackupResponseInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Long datasourceSizeInBytes() { + return this.innerModel().datasourceSizeInBytes(); + } + + public Long dataTransferredInBytes() { + return this.innerModel().dataTransferredInBytes(); + } + + public String backupName() { + return this.innerModel().backupName(); + } + + public String backupMetadata() { + return this.innerModel().backupMetadata(); + } + + public ExecutionStatus status() { + return this.innerModel().status(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Double percentComplete() { + return this.innerModel().percentComplete(); + } + + public String errorCode() { + return this.innerModel().errorCode(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public LtrBackupResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrPreBackupResponseImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrPreBackupResponseImpl.java new file mode 100644 index 0000000000000..52e93387b43ed --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrPreBackupResponseImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrPreBackupResponseInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrPreBackupResponse; + +public final class LtrPreBackupResponseImpl implements LtrPreBackupResponse { + private LtrPreBackupResponseInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + LtrPreBackupResponseImpl( + LtrPreBackupResponseInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public int numberOfContainers() { + return this.innerModel().numberOfContainers(); + } + + public LtrPreBackupResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrServerBackupOperationImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrServerBackupOperationImpl.java new file mode 100644 index 0000000000000..b2e21b253eefb --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LtrServerBackupOperationImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrServerBackupOperationInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ExecutionStatus; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrServerBackupOperation; +import java.time.OffsetDateTime; + +public final class LtrServerBackupOperationImpl implements LtrServerBackupOperation { + private LtrServerBackupOperationInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + LtrServerBackupOperationImpl( + LtrServerBackupOperationInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public Long datasourceSizeInBytes() { + return this.innerModel().datasourceSizeInBytes(); + } + + public Long dataTransferredInBytes() { + return this.innerModel().dataTransferredInBytes(); + } + + public String backupName() { + return this.innerModel().backupName(); + } + + public String backupMetadata() { + return this.innerModel().backupMetadata(); + } + + public ExecutionStatus status() { + return this.innerModel().status(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Double percentComplete() { + return this.innerModel().percentComplete(); + } + + public String errorCode() { + return this.innerModel().errorCode(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public LtrServerBackupOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationNameAvailabilityResourceImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationNameAvailabilityResourceImpl.java new file mode 100644 index 0000000000000..21300cb9457ab --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationNameAvailabilityResourceImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationNameAvailabilityResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationNameAvailabilityReason; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationNameAvailabilityResource; + +public final class MigrationNameAvailabilityResourceImpl implements MigrationNameAvailabilityResource { + private MigrationNameAvailabilityResourceInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + MigrationNameAvailabilityResourceImpl( + MigrationNameAvailabilityResourceInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public MigrationNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public MigrationNameAvailabilityResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationResourceImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationResourceImpl.java new file mode 100644 index 0000000000000..c0de03fbb1e5a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationResourceImpl.java @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.CancelEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.DbServerMetadata; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogicalReplicationOnSourceDbEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationMode; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationResourceForPatch; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationSecretParameters; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationStatus; +import com.azure.resourcemanager.postgresqlflexibleserver.models.OverwriteDbsInTargetEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StartDataMigrationEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.TriggerCutoverEnum; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class MigrationResourceImpl + implements MigrationResource, MigrationResource.Definition, MigrationResource.Update { + private MigrationResourceInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String migrationId() { + return this.innerModel().migrationId(); + } + + public MigrationStatus currentStatus() { + return this.innerModel().currentStatus(); + } + + public MigrationMode migrationMode() { + return this.innerModel().migrationMode(); + } + + public DbServerMetadata sourceDbServerMetadata() { + return this.innerModel().sourceDbServerMetadata(); + } + + public DbServerMetadata targetDbServerMetadata() { + return this.innerModel().targetDbServerMetadata(); + } + + public String sourceDbServerResourceId() { + return this.innerModel().sourceDbServerResourceId(); + } + + public String sourceDbServerFullyQualifiedDomainName() { + return this.innerModel().sourceDbServerFullyQualifiedDomainName(); + } + + public String targetDbServerResourceId() { + return this.innerModel().targetDbServerResourceId(); + } + + public String targetDbServerFullyQualifiedDomainName() { + return this.innerModel().targetDbServerFullyQualifiedDomainName(); + } + + public MigrationSecretParameters secretParameters() { + return this.innerModel().secretParameters(); + } + + public List dbsToMigrate() { + List inner = this.innerModel().dbsToMigrate(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded() { + return this.innerModel().setupLogicalReplicationOnSourceDbIfNeeded(); + } + + public OverwriteDbsInTargetEnum overwriteDbsInTarget() { + return this.innerModel().overwriteDbsInTarget(); + } + + public OffsetDateTime migrationWindowStartTimeInUtc() { + return this.innerModel().migrationWindowStartTimeInUtc(); + } + + public OffsetDateTime migrationWindowEndTimeInUtc() { + return this.innerModel().migrationWindowEndTimeInUtc(); + } + + public StartDataMigrationEnum startDataMigration() { + return this.innerModel().startDataMigration(); + } + + public TriggerCutoverEnum triggerCutover() { + return this.innerModel().triggerCutover(); + } + + public List dbsToTriggerCutoverOn() { + List inner = this.innerModel().dbsToTriggerCutoverOn(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CancelEnum cancel() { + return this.innerModel().cancel(); + } + + public List dbsToCancelMigrationOn() { + List inner = this.innerModel().dbsToCancelMigrationOn(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MigrationResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + private String subscriptionId; + + private String resourceGroupName; + + private String targetDbServerName; + + private String migrationName; + + private MigrationResourceForPatch updateParameters; + + public MigrationResourceImpl withExistingFlexibleServer( + String subscriptionId, String resourceGroupName, String targetDbServerName) { + this.subscriptionId = subscriptionId; + this.resourceGroupName = resourceGroupName; + this.targetDbServerName = targetDbServerName; + return this; + } + + public MigrationResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getMigrations() + .createWithResponse( + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public MigrationResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMigrations() + .createWithResponse( + subscriptionId, resourceGroupName, targetDbServerName, migrationName, this.innerModel(), context) + .getValue(); + return this; + } + + MigrationResourceImpl( + String name, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = new MigrationResourceInner(); + this.serviceManager = serviceManager; + this.migrationName = name; + } + + public MigrationResourceImpl update() { + this.updateParameters = new MigrationResourceForPatch(); + return this; + } + + public MigrationResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMigrations() + .updateWithResponse( + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + updateParameters, + Context.NONE) + .getValue(); + return this; + } + + public MigrationResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMigrations() + .updateWithResponse( + subscriptionId, resourceGroupName, targetDbServerName, migrationName, updateParameters, context) + .getValue(); + return this; + } + + MigrationResourceImpl( + MigrationResourceInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.subscriptionId = Utils.getValueFromIdByName(innerObject.id(), "subscriptions"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.targetDbServerName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + this.migrationName = Utils.getValueFromIdByName(innerObject.id(), "migrations"); + } + + public MigrationResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMigrations() + .getWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, Context.NONE) + .getValue(); + return this; + } + + public MigrationResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMigrations() + .getWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, context) + .getValue(); + return this; + } + + public MigrationResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public MigrationResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public MigrationResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public MigrationResourceImpl withMigrationMode(MigrationMode migrationMode) { + if (isInCreateMode()) { + this.innerModel().withMigrationMode(migrationMode); + return this; + } else { + this.updateParameters.withMigrationMode(migrationMode); + return this; + } + } + + public MigrationResourceImpl withSourceDbServerResourceId(String sourceDbServerResourceId) { + if (isInCreateMode()) { + this.innerModel().withSourceDbServerResourceId(sourceDbServerResourceId); + return this; + } else { + this.updateParameters.withSourceDbServerResourceId(sourceDbServerResourceId); + return this; + } + } + + public MigrationResourceImpl withSourceDbServerFullyQualifiedDomainName( + String sourceDbServerFullyQualifiedDomainName) { + if (isInCreateMode()) { + this.innerModel().withSourceDbServerFullyQualifiedDomainName(sourceDbServerFullyQualifiedDomainName); + return this; + } else { + this.updateParameters.withSourceDbServerFullyQualifiedDomainName(sourceDbServerFullyQualifiedDomainName); + return this; + } + } + + public MigrationResourceImpl withTargetDbServerFullyQualifiedDomainName( + String targetDbServerFullyQualifiedDomainName) { + if (isInCreateMode()) { + this.innerModel().withTargetDbServerFullyQualifiedDomainName(targetDbServerFullyQualifiedDomainName); + return this; + } else { + this.updateParameters.withTargetDbServerFullyQualifiedDomainName(targetDbServerFullyQualifiedDomainName); + return this; + } + } + + public MigrationResourceImpl withSecretParameters(MigrationSecretParameters secretParameters) { + if (isInCreateMode()) { + this.innerModel().withSecretParameters(secretParameters); + return this; + } else { + this.updateParameters.withSecretParameters(secretParameters); + return this; + } + } + + public MigrationResourceImpl withDbsToMigrate(List dbsToMigrate) { + if (isInCreateMode()) { + this.innerModel().withDbsToMigrate(dbsToMigrate); + return this; + } else { + this.updateParameters.withDbsToMigrate(dbsToMigrate); + return this; + } + } + + public MigrationResourceImpl withSetupLogicalReplicationOnSourceDbIfNeeded( + LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded) { + if (isInCreateMode()) { + this.innerModel().withSetupLogicalReplicationOnSourceDbIfNeeded(setupLogicalReplicationOnSourceDbIfNeeded); + return this; + } else { + this + .updateParameters + .withSetupLogicalReplicationOnSourceDbIfNeeded(setupLogicalReplicationOnSourceDbIfNeeded); + return this; + } + } + + public MigrationResourceImpl withOverwriteDbsInTarget(OverwriteDbsInTargetEnum overwriteDbsInTarget) { + if (isInCreateMode()) { + this.innerModel().withOverwriteDbsInTarget(overwriteDbsInTarget); + return this; + } else { + this.updateParameters.withOverwriteDbsInTarget(overwriteDbsInTarget); + return this; + } + } + + public MigrationResourceImpl withMigrationWindowStartTimeInUtc(OffsetDateTime migrationWindowStartTimeInUtc) { + if (isInCreateMode()) { + this.innerModel().withMigrationWindowStartTimeInUtc(migrationWindowStartTimeInUtc); + return this; + } else { + this.updateParameters.withMigrationWindowStartTimeInUtc(migrationWindowStartTimeInUtc); + return this; + } + } + + public MigrationResourceImpl withMigrationWindowEndTimeInUtc(OffsetDateTime migrationWindowEndTimeInUtc) { + this.innerModel().withMigrationWindowEndTimeInUtc(migrationWindowEndTimeInUtc); + return this; + } + + public MigrationResourceImpl withStartDataMigration(StartDataMigrationEnum startDataMigration) { + if (isInCreateMode()) { + this.innerModel().withStartDataMigration(startDataMigration); + return this; + } else { + this.updateParameters.withStartDataMigration(startDataMigration); + return this; + } + } + + public MigrationResourceImpl withTriggerCutover(TriggerCutoverEnum triggerCutover) { + if (isInCreateMode()) { + this.innerModel().withTriggerCutover(triggerCutover); + return this; + } else { + this.updateParameters.withTriggerCutover(triggerCutover); + return this; + } + } + + public MigrationResourceImpl withDbsToTriggerCutoverOn(List dbsToTriggerCutoverOn) { + if (isInCreateMode()) { + this.innerModel().withDbsToTriggerCutoverOn(dbsToTriggerCutoverOn); + return this; + } else { + this.updateParameters.withDbsToTriggerCutoverOn(dbsToTriggerCutoverOn); + return this; + } + } + + public MigrationResourceImpl withCancel(CancelEnum cancel) { + if (isInCreateMode()) { + this.innerModel().withCancel(cancel); + return this; + } else { + this.updateParameters.withCancel(cancel); + return this; + } + } + + public MigrationResourceImpl withDbsToCancelMigrationOn(List dbsToCancelMigrationOn) { + if (isInCreateMode()) { + this.innerModel().withDbsToCancelMigrationOn(dbsToCancelMigrationOn); + return this; + } else { + this.updateParameters.withDbsToCancelMigrationOn(dbsToCancelMigrationOn); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationsClientImpl.java new file mode 100644 index 0000000000000..a95d22c2f1504 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationsClientImpl.java @@ -0,0 +1,1207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.MigrationsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationListFilter; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationResourceForPatch; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MigrationsClient. */ +public final class MigrationsClientImpl implements MigrationsClient { + /** The proxy service used to perform REST calls. */ + private final MigrationsService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of MigrationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MigrationsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(MigrationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientMigrations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface MigrationsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("targetDbServerName") String targetDbServerName, + @PathParam("migrationName") String migrationName, + @BodyParam("application/json") MigrationResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("targetDbServerName") String targetDbServerName, + @PathParam("migrationName") String migrationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("targetDbServerName") String targetDbServerName, + @PathParam("migrationName") String migrationName, + @BodyParam("application/json") MigrationResourceForPatch parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("targetDbServerName") String targetDbServerName, + @PathParam("migrationName") String migrationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTargetServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("targetDbServerName") String targetDbServerName, + @QueryParam("migrationListFilter") MigrationListFilter migrationListFilter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTargetServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for creating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (migrationName == null) { + return Mono.error(new IllegalArgumentException("Parameter migrationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for creating a migration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (migrationName == null) { + return Mono.error(new IllegalArgumentException("Parameter migrationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + parameters, + accept, + context); + } + + /** + * Creates a new migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for creating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceInner parameters) { + return createWithResponseAsync(subscriptionId, resourceGroupName, targetDbServerName, migrationName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for creating a migration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceInner parameters, + Context context) { + return createWithResponseAsync( + subscriptionId, resourceGroupName, targetDbServerName, migrationName, parameters, context) + .block(); + } + + /** + * Creates a new migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for creating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MigrationResourceInner create( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceInner parameters) { + return createWithResponse( + subscriptionId, resourceGroupName, targetDbServerName, migrationName, parameters, Context.NONE) + .getValue(); + } + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a migration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (migrationName == null) { + return Mono.error(new IllegalArgumentException("Parameter migrationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 details of a migration along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (migrationName == null) { + return Mono.error(new IllegalArgumentException("Parameter migrationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + accept, + context); + } + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a migration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName) { + return getWithResponseAsync(subscriptionId, resourceGroupName, targetDbServerName, migrationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 details of a migration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context) { + return getWithResponseAsync(subscriptionId, resourceGroupName, targetDbServerName, migrationName, context) + .block(); + } + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a migration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MigrationResourceInner get( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName) { + return getWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, Context.NONE) + .getValue(); + } + + /** + * Updates an existing migration. The request body can contain one to many of the mutable properties present in the + * migration definition. Certain property updates initiate migration state transitions. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for updating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceForPatch parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (migrationName == null) { + return Mono.error(new IllegalArgumentException("Parameter migrationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing migration. The request body can contain one to many of the mutable properties present in the + * migration definition. Certain property updates initiate migration state transitions. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for updating a migration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceForPatch parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (migrationName == null) { + return Mono.error(new IllegalArgumentException("Parameter migrationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + parameters, + accept, + context); + } + + /** + * Updates an existing migration. The request body can contain one to many of the mutable properties present in the + * migration definition. Certain property updates initiate migration state transitions. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for updating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceForPatch parameters) { + return updateWithResponseAsync(subscriptionId, resourceGroupName, targetDbServerName, migrationName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing migration. The request body can contain one to many of the mutable properties present in the + * migration definition. Certain property updates initiate migration state transitions. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for updating a migration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceForPatch parameters, + Context context) { + return updateWithResponseAsync( + subscriptionId, resourceGroupName, targetDbServerName, migrationName, parameters, context) + .block(); + } + + /** + * Updates an existing migration. The request body can contain one to many of the mutable properties present in the + * migration definition. Certain property updates initiate migration state transitions. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param parameters The required parameters for updating a migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MigrationResourceInner update( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + MigrationResourceForPatch parameters) { + return updateWithResponse( + subscriptionId, resourceGroupName, targetDbServerName, migrationName, parameters, Context.NONE) + .getValue(); + } + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + public Mono> deleteWithResponseAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (migrationName == null) { + return Mono.error(new IllegalArgumentException("Parameter migrationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (migrationName == null) { + return Mono.error(new IllegalArgumentException("Parameter migrationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationName, + accept, + context); + } + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) + public Mono deleteAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName) { + return deleteWithResponseAsync(subscriptionId, resourceGroupName, targetDbServerName, migrationName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context) { + return deleteWithResponseAsync(subscriptionId, resourceGroupName, targetDbServerName, migrationName, context) + .block(); + } + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName) { + deleteWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, Context.NONE); + } + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationListFilter Migration list filter. Retrieves either active migrations or all migrations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTargetServerSinglePageAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationListFilter migrationListFilter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByTargetServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationListFilter, + 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 migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationListFilter Migration list filter. Retrieves either active migrations or all migrations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTargetServerSinglePageAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationListFilter migrationListFilter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTargetServer( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + migrationListFilter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationListFilter Migration list filter. Retrieves either active migrations or all migrations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByTargetServerAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationListFilter migrationListFilter) { + return new PagedFlux<>( + () -> + listByTargetServerSinglePageAsync( + subscriptionId, resourceGroupName, targetDbServerName, migrationListFilter), + nextLink -> listByTargetServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByTargetServerAsync( + String subscriptionId, String resourceGroupName, String targetDbServerName) { + final MigrationListFilter migrationListFilter = null; + return new PagedFlux<>( + () -> + listByTargetServerSinglePageAsync( + subscriptionId, resourceGroupName, targetDbServerName, migrationListFilter), + nextLink -> listByTargetServerNextSinglePageAsync(nextLink)); + } + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationListFilter Migration list filter. Retrieves either active migrations or all migrations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTargetServerAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationListFilter migrationListFilter, + Context context) { + return new PagedFlux<>( + () -> + listByTargetServerSinglePageAsync( + subscriptionId, resourceGroupName, targetDbServerName, migrationListFilter, context), + nextLink -> listByTargetServerNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTargetServer( + String subscriptionId, String resourceGroupName, String targetDbServerName) { + final MigrationListFilter migrationListFilter = null; + return new PagedIterable<>( + listByTargetServerAsync(subscriptionId, resourceGroupName, targetDbServerName, migrationListFilter)); + } + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationListFilter Migration list filter. Retrieves either active migrations or all migrations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTargetServer( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationListFilter migrationListFilter, + Context context) { + return new PagedIterable<>( + listByTargetServerAsync( + subscriptionId, resourceGroupName, targetDbServerName, migrationListFilter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTargetServerNextSinglePageAsync(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.listByTargetServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTargetServerNextSinglePageAsync( + 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 + .listByTargetServerNext(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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationsImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationsImpl.java new file mode 100644 index 0000000000000..79b8bc8ee00b8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/MigrationsImpl.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.MigrationsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationListFilter; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Migrations; + +public final class MigrationsImpl implements Migrations { + private static final ClientLogger LOGGER = new ClientLogger(MigrationsImpl.class); + + private final MigrationsClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public MigrationsImpl( + MigrationsClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MigrationResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MigrationResource get( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName) { + MigrationResourceInner inner = + this.serviceClient().get(subscriptionId, resourceGroupName, targetDbServerName, migrationName); + if (inner != null) { + return new MigrationResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, context); + } + + public void delete( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName) { + this.serviceClient().delete(subscriptionId, resourceGroupName, targetDbServerName, migrationName); + } + + public PagedIterable listByTargetServer( + String subscriptionId, String resourceGroupName, String targetDbServerName) { + PagedIterable inner = + this.serviceClient().listByTargetServer(subscriptionId, resourceGroupName, targetDbServerName); + return Utils.mapPage(inner, inner1 -> new MigrationResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTargetServer( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationListFilter migrationListFilter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByTargetServer( + subscriptionId, resourceGroupName, targetDbServerName, migrationListFilter, context); + return Utils.mapPage(inner, inner1 -> new MigrationResourceImpl(inner1, this.manager())); + } + + public MigrationResource getById(String id) { + String subscriptionId = Utils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String targetDbServerName = Utils.getValueFromIdByName(id, "flexibleServers"); + if (targetDbServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String migrationName = Utils.getValueFromIdByName(id, "migrations"); + if (migrationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'migrations'.", id))); + } + return this + .getWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String subscriptionId = Utils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String targetDbServerName = Utils.getValueFromIdByName(id, "flexibleServers"); + if (targetDbServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String migrationName = Utils.getValueFromIdByName(id, "migrations"); + if (migrationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'migrations'.", id))); + } + return this.getWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, context); + } + + public void deleteById(String id) { + String subscriptionId = Utils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String targetDbServerName = Utils.getValueFromIdByName(id, "flexibleServers"); + if (targetDbServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String migrationName = Utils.getValueFromIdByName(id, "migrations"); + if (migrationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'migrations'.", id))); + } + this.deleteWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String subscriptionId = Utils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String targetDbServerName = Utils.getValueFromIdByName(id, "flexibleServers"); + if (targetDbServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + } + String migrationName = Utils.getValueFromIdByName(id, "migrations"); + if (migrationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'migrations'.", id))); + } + return this.deleteWithResponse(subscriptionId, resourceGroupName, targetDbServerName, migrationName, context); + } + + private MigrationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + public MigrationResourceImpl define(String name) { + return new MigrationResourceImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java index 1a56154fc0d42..00ff7ca5eb7a0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java @@ -29,11 +29,17 @@ import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ConfigurationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.DatabasesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.FirewallRulesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.FlexibleServersClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LogFilesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LtrBackupOperationsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.MigrationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.OperationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PostgreSqlManagementClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerCapabilitiesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServersClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; import java.io.IOException; @@ -156,6 +162,18 @@ public LocationBasedCapabilitiesClient getLocationBasedCapabilities() { return this.locationBasedCapabilities; } + /** The ServerCapabilitiesClient object to access its operations. */ + private final ServerCapabilitiesClient serverCapabilities; + + /** + * Gets the ServerCapabilitiesClient object to access its operations. + * + * @return the ServerCapabilitiesClient object. + */ + public ServerCapabilitiesClient getServerCapabilities() { + return this.serverCapabilities; + } + /** The CheckNameAvailabilitiesClient object to access its operations. */ private final CheckNameAvailabilitiesClient checkNameAvailabilities; @@ -228,6 +246,30 @@ public ServersClient getServers() { return this.servers; } + /** The MigrationsClient object to access its operations. */ + private final MigrationsClient migrations; + + /** + * Gets the MigrationsClient object to access its operations. + * + * @return the MigrationsClient object. + */ + public MigrationsClient getMigrations() { + return this.migrations; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + /** The OperationsClient object to access its operations. */ private final OperationsClient operations; @@ -264,6 +306,18 @@ public ReplicasClient getReplicas() { return this.replicas; } + /** The LogFilesClient object to access its operations. */ + private final LogFilesClient logFiles; + + /** + * Gets the LogFilesClient object to access its operations. + * + * @return the LogFilesClient object. + */ + public LogFilesClient getLogFiles() { + return this.logFiles; + } + /** The VirtualNetworkSubnetUsagesClient object to access its operations. */ private final VirtualNetworkSubnetUsagesClient virtualNetworkSubnetUsages; @@ -276,6 +330,30 @@ public VirtualNetworkSubnetUsagesClient getVirtualNetworkSubnetUsages() { return this.virtualNetworkSubnetUsages; } + /** The FlexibleServersClient object to access its operations. */ + private final FlexibleServersClient flexibleServers; + + /** + * Gets the FlexibleServersClient object to access its operations. + * + * @return the FlexibleServersClient object. + */ + public FlexibleServersClient getFlexibleServers() { + return this.flexibleServers; + } + + /** The LtrBackupOperationsClient object to access its operations. */ + private final LtrBackupOperationsClient ltrBackupOperations; + + /** + * Gets the LtrBackupOperationsClient object to access its operations. + * + * @return the LtrBackupOperationsClient object. + */ + public LtrBackupOperationsClient getLtrBackupOperations() { + return this.ltrBackupOperations; + } + /** * Initializes an instance of PostgreSqlManagementClient client. * @@ -298,20 +376,26 @@ public VirtualNetworkSubnetUsagesClient getVirtualNetworkSubnetUsages() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2022-12-01"; + this.apiVersion = "2023-03-01-preview"; this.administrators = new AdministratorsClientImpl(this); this.backups = new BackupsClientImpl(this); this.locationBasedCapabilities = new LocationBasedCapabilitiesClientImpl(this); + this.serverCapabilities = new ServerCapabilitiesClientImpl(this); this.checkNameAvailabilities = new CheckNameAvailabilitiesClientImpl(this); this.checkNameAvailabilityWithLocations = new CheckNameAvailabilityWithLocationsClientImpl(this); this.configurations = new ConfigurationsClientImpl(this); this.databases = new DatabasesClientImpl(this); this.firewallRules = new FirewallRulesClientImpl(this); this.servers = new ServersClientImpl(this); + this.migrations = new MigrationsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); this.operations = new OperationsClientImpl(this); this.getPrivateDnsZoneSuffixes = new GetPrivateDnsZoneSuffixesClientImpl(this); this.replicas = new ReplicasClientImpl(this); + this.logFiles = new LogFilesClientImpl(this); this.virtualNetworkSubnetUsages = new VirtualNetworkSubnetUsagesClientImpl(this); + this.flexibleServers = new FlexibleServersClientImpl(this); + this.ltrBackupOperations = new LtrBackupOperationsClientImpl(this); } /** diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ResourceProvidersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..1f62ceee77a07 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.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.postgresqlflexibleserver.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationNameAvailabilityResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientResourceProviders to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/checkMigrationNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkMigrationNameAvailability( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("targetDbServerName") String targetDbServerName, + @BodyParam("application/json") MigrationNameAvailabilityResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> checkMigrationNameAvailabilityWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkMigrationNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkMigrationNameAvailabilityWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (targetDbServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetDbServerName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkMigrationNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + targetDbServerName, + parameters, + accept, + context); + } + + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono checkMigrationNameAvailabilityAsync( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters) { + return checkMigrationNameAvailabilityWithResponseAsync( + subscriptionId, resourceGroupName, targetDbServerName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkMigrationNameAvailabilityWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters, + Context context) { + return checkMigrationNameAvailabilityWithResponseAsync( + subscriptionId, resourceGroupName, targetDbServerName, parameters, context) + .block(); + } + + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MigrationNameAvailabilityResourceInner checkMigrationNameAvailability( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters) { + return checkMigrationNameAvailabilityWithResponse( + subscriptionId, resourceGroupName, targetDbServerName, parameters, Context.NONE) + .getValue(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ResourceProvidersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..1ebb021730246 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ResourceProvidersImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationNameAvailabilityResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationNameAvailabilityResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ResourceProviders; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response checkMigrationNameAvailabilityWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .checkMigrationNameAvailabilityWithResponse( + subscriptionId, resourceGroupName, targetDbServerName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MigrationNameAvailabilityResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MigrationNameAvailabilityResource checkMigrationNameAvailability( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters) { + MigrationNameAvailabilityResourceInner inner = + this + .serviceClient() + .checkMigrationNameAvailability(subscriptionId, resourceGroupName, targetDbServerName, parameters); + if (inner != null) { + return new MigrationNameAvailabilityResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerCapabilitiesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerCapabilitiesClientImpl.java new file mode 100644 index 0000000000000..f5ba4a46fce82 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerCapabilitiesClientImpl.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.fluent.ServerCapabilitiesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilitiesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerCapabilitiesClient. */ +public final class ServerCapabilitiesClientImpl implements ServerCapabilitiesClient { + /** The proxy service used to perform REST calls. */ + private final ServerCapabilitiesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServerCapabilitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerCapabilitiesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerCapabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerCapabilities to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ServerCapabilitiesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/capabilities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capabilities for a flexible server along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 capabilities for a flexible server along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capabilities for a flexible server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serverName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 capabilities for a flexible server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capabilities for a flexible server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serverName) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName)); + } + + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 capabilities for a flexible server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capability for the PostgreSQL server along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capability for the PostgreSQL server along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerCapabilitiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerCapabilitiesImpl.java new file mode 100644 index 0000000000000..7cc384e083312 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerCapabilitiesImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.fluent.ServerCapabilitiesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerCapability; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerCapabilities; + +public final class ServerCapabilitiesImpl implements ServerCapabilities { + private static final ClientLogger LOGGER = new ClientLogger(ServerCapabilitiesImpl.class); + + private final ServerCapabilitiesClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerCapabilitiesImpl( + ServerCapabilitiesClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new FlexibleServerCapabilityImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new FlexibleServerCapabilityImpl(inner1, this.manager())); + } + + private ServerCapabilitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java index b21887357a17d..1fa5786f71f78 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java @@ -383,8 +383,13 @@ public ServerImpl withBackup(Backup backup) { } public ServerImpl withNetwork(Network network) { - this.innerModel().withNetwork(network); - return this; + if (isInCreateMode()) { + this.innerModel().withNetwork(network); + return this; + } else { + this.updateParameters.withNetwork(network); + return this; + } } public ServerImpl withHighAvailability(HighAvailability highAvailability) { @@ -422,11 +427,6 @@ public ServerImpl withReplicationRole(ReplicationRole replicationRole) { } } - public ServerImpl withReplicaCapacity(Integer replicaCapacity) { - this.innerModel().withReplicaCapacity(replicaCapacity); - return this; - } - public ServerImpl withCreateMode(CreateMode createMode) { this.innerModel().withCreateMode(createMode); return this; diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AdminCredentials.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AdminCredentials.java new file mode 100644 index 0000000000000..3f0a9bd3218b6 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AdminCredentials.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Server admin credentials. */ +@Fluent +public final class AdminCredentials { + /* + * Password for source server. + */ + @JsonProperty(value = "sourceServerPassword", required = true) + private String sourceServerPassword; + + /* + * Password for target server. + */ + @JsonProperty(value = "targetServerPassword", required = true) + private String targetServerPassword; + + /** Creates an instance of AdminCredentials class. */ + public AdminCredentials() { + } + + /** + * Get the sourceServerPassword property: Password for source server. + * + * @return the sourceServerPassword value. + */ + public String sourceServerPassword() { + return this.sourceServerPassword; + } + + /** + * Set the sourceServerPassword property: Password for source server. + * + * @param sourceServerPassword the sourceServerPassword value to set. + * @return the AdminCredentials object itself. + */ + public AdminCredentials withSourceServerPassword(String sourceServerPassword) { + this.sourceServerPassword = sourceServerPassword; + return this; + } + + /** + * Get the targetServerPassword property: Password for target server. + * + * @return the targetServerPassword value. + */ + public String targetServerPassword() { + return this.targetServerPassword; + } + + /** + * Set the targetServerPassword property: Password for target server. + * + * @param targetServerPassword the targetServerPassword value to set. + * @return the AdminCredentials object itself. + */ + public AdminCredentials withTargetServerPassword(String targetServerPassword) { + this.targetServerPassword = targetServerPassword; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceServerPassword() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerPassword in model AdminCredentials")); + } + if (targetServerPassword() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetServerPassword in model AdminCredentials")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AdminCredentials.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AzureManagedDiskPerformanceTiers.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AzureManagedDiskPerformanceTiers.java new file mode 100644 index 0000000000000..e80e0b4d57ec7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AzureManagedDiskPerformanceTiers.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Name of storage tier for IOPS. */ +public final class AzureManagedDiskPerformanceTiers extends ExpandableStringEnum { + /** Static value P1 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P1 = fromString("P1"); + + /** Static value P2 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P2 = fromString("P2"); + + /** Static value P3 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P3 = fromString("P3"); + + /** Static value P4 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P4 = fromString("P4"); + + /** Static value P6 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P6 = fromString("P6"); + + /** Static value P10 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P10 = fromString("P10"); + + /** Static value P15 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P15 = fromString("P15"); + + /** Static value P20 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P20 = fromString("P20"); + + /** Static value P30 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P30 = fromString("P30"); + + /** Static value P40 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P40 = fromString("P40"); + + /** Static value P50 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P50 = fromString("P50"); + + /** Static value P60 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P60 = fromString("P60"); + + /** Static value P70 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P70 = fromString("P70"); + + /** Static value P80 for AzureManagedDiskPerformanceTiers. */ + public static final AzureManagedDiskPerformanceTiers P80 = fromString("P80"); + + /** + * Creates a new instance of AzureManagedDiskPerformanceTiers value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AzureManagedDiskPerformanceTiers() { + } + + /** + * Creates or finds a AzureManagedDiskPerformanceTiers from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureManagedDiskPerformanceTiers. + */ + @JsonCreator + public static AzureManagedDiskPerformanceTiers fromString(String name) { + return fromString(name, AzureManagedDiskPerformanceTiers.class); + } + + /** + * Gets known AzureManagedDiskPerformanceTiers values. + * + * @return known AzureManagedDiskPerformanceTiers values. + */ + public static Collection values() { + return values(AzureManagedDiskPerformanceTiers.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/BackupRequestBase.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/BackupRequestBase.java new file mode 100644 index 0000000000000..2d3439b46147c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/BackupRequestBase.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** BackupRequestBase is the base for all backup request. */ +@Fluent +public class BackupRequestBase { + /* + * Backup Settings + */ + @JsonProperty(value = "backupSettings", required = true) + private BackupSettings backupSettings; + + /** Creates an instance of BackupRequestBase class. */ + public BackupRequestBase() { + } + + /** + * Get the backupSettings property: Backup Settings. + * + * @return the backupSettings value. + */ + public BackupSettings backupSettings() { + return this.backupSettings; + } + + /** + * Set the backupSettings property: Backup Settings. + * + * @param backupSettings the backupSettings value to set. + * @return the BackupRequestBase object itself. + */ + public BackupRequestBase withBackupSettings(BackupSettings backupSettings) { + this.backupSettings = backupSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (backupSettings() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property backupSettings in model BackupRequestBase")); + } else { + backupSettings().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BackupRequestBase.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/BackupSettings.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/BackupSettings.java new file mode 100644 index 0000000000000..588994cbd0675 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/BackupSettings.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The settings for the long term backup. */ +@Fluent +public final class BackupSettings { + /* + * Backup Name for the current backup + */ + @JsonProperty(value = "backupName", required = true) + private String backupName; + + /** Creates an instance of BackupSettings class. */ + public BackupSettings() { + } + + /** + * Get the backupName property: Backup Name for the current backup. + * + * @return the backupName value. + */ + public String backupName() { + return this.backupName; + } + + /** + * Set the backupName property: Backup Name for the current backup. + * + * @param backupName the backupName value to set. + * @return the BackupSettings object itself. + */ + public BackupSettings withBackupName(String backupName) { + this.backupName = backupName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (backupName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property backupName in model BackupSettings")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BackupSettings.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/BackupStoreDetails.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/BackupStoreDetails.java new file mode 100644 index 0000000000000..8a316146cffee --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/BackupStoreDetails.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Details about the target where the backup content will be stored. */ +@Fluent +public final class BackupStoreDetails { + /* + * List of SAS uri of storage containers where backup data is to be streamed/copied. + */ + @JsonProperty(value = "sasUriList", required = true) + private List sasUriList; + + /** Creates an instance of BackupStoreDetails class. */ + public BackupStoreDetails() { + } + + /** + * Get the sasUriList property: List of SAS uri of storage containers where backup data is to be streamed/copied. + * + * @return the sasUriList value. + */ + public List sasUriList() { + return this.sasUriList; + } + + /** + * Set the sasUriList property: List of SAS uri of storage containers where backup data is to be streamed/copied. + * + * @param sasUriList the sasUriList value to set. + * @return the BackupStoreDetails object itself. + */ + public BackupStoreDetails withSasUriList(List sasUriList) { + this.sasUriList = sasUriList; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sasUriList() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property sasUriList in model BackupStoreDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BackupStoreDetails.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CancelEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CancelEnum.java new file mode 100644 index 0000000000000..5a1080851aa7f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CancelEnum.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** To trigger cancel for entire migration we need to send this flag as True. */ +public final class CancelEnum extends ExpandableStringEnum { + /** Static value True for CancelEnum. */ + public static final CancelEnum TRUE = fromString("True"); + + /** Static value False for CancelEnum. */ + public static final CancelEnum FALSE = fromString("False"); + + /** + * Creates a new instance of CancelEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CancelEnum() { + } + + /** + * Creates or finds a CancelEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding CancelEnum. + */ + @JsonCreator + public static CancelEnum fromString(String name) { + return fromString(name, CancelEnum.class); + } + + /** + * Gets known CancelEnum values. + * + * @return known CancelEnum values. + */ + public static Collection values() { + return values(CancelEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java index 632d3764929e5..f38de622b0790 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java @@ -5,18 +5,18 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** location capability. */ +/** Capability for the PostgreSQL server. */ @Immutable public final class CapabilitiesListResult { /* * A list of supported capabilities. */ @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) - private List value; + private List value; /* * Link to retrieve next page of results. @@ -33,7 +33,7 @@ public CapabilitiesListResult() { * * @return the value value. */ - public List value() { + public List value() { return this.value; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityBase.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityBase.java new file mode 100644 index 0000000000000..a006ffc7070b4 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityBase.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Base object for representing capability. */ +@Immutable +public class CapabilityBase { + /* + * The status of the capability. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /* + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private String reason; + + /** Creates an instance of CapabilityBase class. */ + public CapabilityBase() { + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityProperties.java deleted file mode 100644 index 3f51899df3e80..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityProperties.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import java.util.List; - -/** An immutable client-side representation of CapabilityProperties. */ -public interface CapabilityProperties { - /** - * Gets the zone property: zone name. - * - * @return the zone value. - */ - String zone(); - - /** - * Gets the supportedHAMode property: Supported high availability mode. - * - * @return the supportedHAMode value. - */ - List supportedHAMode(); - - /** - * Gets the geoBackupSupported property: A value indicating whether a new server in this region can have geo-backups - * to paired region. - * - * @return the geoBackupSupported value. - */ - Boolean geoBackupSupported(); - - /** - * Gets the zoneRedundantHaSupported property: A value indicating whether a new server in this region can support - * multi zone HA. - * - * @return the zoneRedundantHaSupported value. - */ - Boolean zoneRedundantHaSupported(); - - /** - * Gets the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether a new server in this region - * can have geo-backups to paired region. - * - * @return the zoneRedundantHaAndGeoBackupSupported value. - */ - Boolean zoneRedundantHaAndGeoBackupSupported(); - - /** - * Gets the supportedFlexibleServerEditions property: The supportedFlexibleServerEditions property. - * - * @return the supportedFlexibleServerEditions value. - */ - List supportedFlexibleServerEditions(); - - /** - * Gets the supportedHyperscaleNodeEditions property: The supportedHyperscaleNodeEditions property. - * - * @return the supportedHyperscaleNodeEditions value. - */ - List supportedHyperscaleNodeEditions(); - - /** - * Gets the fastProvisioningSupported property: A value indicating whether fast provisioning is supported in this - * region. - * - * @return the fastProvisioningSupported value. - */ - Boolean fastProvisioningSupported(); - - /** - * Gets the supportedFastProvisioningEditions property: The supportedFastProvisioningEditions property. - * - * @return the supportedFastProvisioningEditions value. - */ - List supportedFastProvisioningEditions(); - - /** - * Gets the status property: The status. - * - * @return the status value. - */ - String status(); - - /** - * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner object. - * - * @return the inner object. - */ - CapabilityPropertiesInner innerModel(); -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityStatus.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityStatus.java new file mode 100644 index 0000000000000..62faf1de1eaf6 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityStatus.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The status of the capability. */ +public enum CapabilityStatus { + /** Enum value Visible. */ + VISIBLE("Visible"), + + /** Enum value Available. */ + AVAILABLE("Available"), + + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a CapabilityStatus instance. */ + private final String value; + + CapabilityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CapabilityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed CapabilityStatus object, or null if unable to parse. + */ + @JsonCreator + public static CapabilityStatus fromString(String value) { + if (value == null) { + return null; + } + CapabilityStatus[] items = CapabilityStatus.values(); + for (CapabilityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java index 477961dc9905c..e312c1a18fc8c 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java @@ -28,6 +28,9 @@ public final class CreateMode extends ExpandableStringEnum { /** Static value Replica for CreateMode. */ public static final CreateMode REPLICA = fromString("Replica"); + /** Static value ReviveDropped for CreateMode. */ + public static final CreateMode REVIVE_DROPPED = fromString("ReviveDropped"); + /** * Creates a new instance of CreateMode value. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DataEncryption.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DataEncryption.java index 1eb652d25833a..b86e15325a5b0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DataEncryption.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DataEncryption.java @@ -11,29 +11,53 @@ @Fluent public final class DataEncryption { /* - * URI for the key for data encryption for primary server. + * URI for the key in keyvault for data encryption of the primary server. */ @JsonProperty(value = "primaryKeyURI") private String primaryKeyUri; /* - * Resource Id for the User assigned identity to be used for data encryption for primary server. + * Resource Id for the User assigned identity to be used for data encryption of the primary server. */ @JsonProperty(value = "primaryUserAssignedIdentityId") private String primaryUserAssignedIdentityId; + /* + * URI for the key in keyvault for data encryption for geo-backup of server. + */ + @JsonProperty(value = "geoBackupKeyURI") + private String geoBackupKeyUri; + + /* + * Resource Id for the User assigned identity to be used for data encryption for geo-backup of server. + */ + @JsonProperty(value = "geoBackupUserAssignedIdentityId") + private String geoBackupUserAssignedIdentityId; + /* * Data encryption type to depict if it is System Managed vs Azure Key vault. */ @JsonProperty(value = "type") private ArmServerKeyType type; + /* + * Primary encryption key status for Data encryption enabled server. + */ + @JsonProperty(value = "primaryEncryptionKeyStatus") + private KeyStatusEnum primaryEncryptionKeyStatus; + + /* + * Geo-backup encryption key status for Data encryption enabled server. + */ + @JsonProperty(value = "geoBackupEncryptionKeyStatus") + private KeyStatusEnum geoBackupEncryptionKeyStatus; + /** Creates an instance of DataEncryption class. */ public DataEncryption() { } /** - * Get the primaryKeyUri property: URI for the key for data encryption for primary server. + * Get the primaryKeyUri property: URI for the key in keyvault for data encryption of the primary server. * * @return the primaryKeyUri value. */ @@ -42,7 +66,7 @@ public String primaryKeyUri() { } /** - * Set the primaryKeyUri property: URI for the key for data encryption for primary server. + * Set the primaryKeyUri property: URI for the key in keyvault for data encryption of the primary server. * * @param primaryKeyUri the primaryKeyUri value to set. * @return the DataEncryption object itself. @@ -54,7 +78,7 @@ public DataEncryption withPrimaryKeyUri(String primaryKeyUri) { /** * Get the primaryUserAssignedIdentityId property: Resource Id for the User assigned identity to be used for data - * encryption for primary server. + * encryption of the primary server. * * @return the primaryUserAssignedIdentityId value. */ @@ -64,7 +88,7 @@ public String primaryUserAssignedIdentityId() { /** * Set the primaryUserAssignedIdentityId property: Resource Id for the User assigned identity to be used for data - * encryption for primary server. + * encryption of the primary server. * * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. * @return the DataEncryption object itself. @@ -74,6 +98,48 @@ public DataEncryption withPrimaryUserAssignedIdentityId(String primaryUserAssign return this; } + /** + * Get the geoBackupKeyUri property: URI for the key in keyvault for data encryption for geo-backup of server. + * + * @return the geoBackupKeyUri value. + */ + public String geoBackupKeyUri() { + return this.geoBackupKeyUri; + } + + /** + * Set the geoBackupKeyUri property: URI for the key in keyvault for data encryption for geo-backup of server. + * + * @param geoBackupKeyUri the geoBackupKeyUri value to set. + * @return the DataEncryption object itself. + */ + public DataEncryption withGeoBackupKeyUri(String geoBackupKeyUri) { + this.geoBackupKeyUri = geoBackupKeyUri; + return this; + } + + /** + * Get the geoBackupUserAssignedIdentityId property: Resource Id for the User assigned identity to be used for data + * encryption for geo-backup of server. + * + * @return the geoBackupUserAssignedIdentityId value. + */ + public String geoBackupUserAssignedIdentityId() { + return this.geoBackupUserAssignedIdentityId; + } + + /** + * Set the geoBackupUserAssignedIdentityId property: Resource Id for the User assigned identity to be used for data + * encryption for geo-backup of server. + * + * @param geoBackupUserAssignedIdentityId the geoBackupUserAssignedIdentityId value to set. + * @return the DataEncryption object itself. + */ + public DataEncryption withGeoBackupUserAssignedIdentityId(String geoBackupUserAssignedIdentityId) { + this.geoBackupUserAssignedIdentityId = geoBackupUserAssignedIdentityId; + return this; + } + /** * Get the type property: Data encryption type to depict if it is System Managed vs Azure Key vault. * @@ -94,6 +160,48 @@ public DataEncryption withType(ArmServerKeyType type) { return this; } + /** + * Get the primaryEncryptionKeyStatus property: Primary encryption key status for Data encryption enabled server. + * + * @return the primaryEncryptionKeyStatus value. + */ + public KeyStatusEnum primaryEncryptionKeyStatus() { + return this.primaryEncryptionKeyStatus; + } + + /** + * Set the primaryEncryptionKeyStatus property: Primary encryption key status for Data encryption enabled server. + * + * @param primaryEncryptionKeyStatus the primaryEncryptionKeyStatus value to set. + * @return the DataEncryption object itself. + */ + public DataEncryption withPrimaryEncryptionKeyStatus(KeyStatusEnum primaryEncryptionKeyStatus) { + this.primaryEncryptionKeyStatus = primaryEncryptionKeyStatus; + return this; + } + + /** + * Get the geoBackupEncryptionKeyStatus property: Geo-backup encryption key status for Data encryption enabled + * server. + * + * @return the geoBackupEncryptionKeyStatus value. + */ + public KeyStatusEnum geoBackupEncryptionKeyStatus() { + return this.geoBackupEncryptionKeyStatus; + } + + /** + * Set the geoBackupEncryptionKeyStatus property: Geo-backup encryption key status for Data encryption enabled + * server. + * + * @param geoBackupEncryptionKeyStatus the geoBackupEncryptionKeyStatus value to set. + * @return the DataEncryption object itself. + */ + public DataEncryption withGeoBackupEncryptionKeyStatus(KeyStatusEnum geoBackupEncryptionKeyStatus) { + this.geoBackupEncryptionKeyStatus = geoBackupEncryptionKeyStatus; + return this; + } + /** * Validates the instance. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DbServerMetadata.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DbServerMetadata.java new file mode 100644 index 0000000000000..e664144ef40fc --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DbServerMetadata.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Database server metadata. */ +@Fluent +public final class DbServerMetadata { + /* + * Location of database server + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Version for database engine + */ + @JsonProperty(value = "version") + private String version; + + /* + * Storage size in MB for database server + */ + @JsonProperty(value = "storageMb") + private Integer storageMb; + + /* + * SKU for the database server + */ + @JsonProperty(value = "sku") + private ServerSkuAutoGenerated sku; + + /** Creates an instance of DbServerMetadata class. */ + public DbServerMetadata() { + } + + /** + * Get the location property: Location of database server. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the version property: Version for database engine. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version for database engine. + * + * @param version the version value to set. + * @return the DbServerMetadata object itself. + */ + public DbServerMetadata withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the storageMb property: Storage size in MB for database server. + * + * @return the storageMb value. + */ + public Integer storageMb() { + return this.storageMb; + } + + /** + * Set the storageMb property: Storage size in MB for database server. + * + * @param storageMb the storageMb value to set. + * @return the DbServerMetadata object itself. + */ + public DbServerMetadata withStorageMb(Integer storageMb) { + this.storageMb = storageMb; + return this; + } + + /** + * Get the sku property: SKU for the database server. + * + * @return the sku value. + */ + public ServerSkuAutoGenerated sku() { + return this.sku; + } + + /** + * Set the sku property: SKU for the database server. + * + * @param sku the sku value to set. + * @return the DbServerMetadata object itself. + */ + public DbServerMetadata withSku(ServerSkuAutoGenerated sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ExecutionStatus.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ExecutionStatus.java new file mode 100644 index 0000000000000..b325710487cf0 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ExecutionStatus.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Service-set extensible enum indicating the status of operation. */ +public final class ExecutionStatus extends ExpandableStringEnum { + /** Static value Running for ExecutionStatus. */ + public static final ExecutionStatus RUNNING = fromString("Running"); + + /** Static value Cancelled for ExecutionStatus. */ + public static final ExecutionStatus CANCELLED = fromString("Cancelled"); + + /** Static value Failed for ExecutionStatus. */ + public static final ExecutionStatus FAILED = fromString("Failed"); + + /** Static value Succeeded for ExecutionStatus. */ + public static final ExecutionStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Creates a new instance of ExecutionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ExecutionStatus() { + } + + /** + * Creates or finds a ExecutionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExecutionStatus. + */ + @JsonCreator + public static ExecutionStatus fromString(String name) { + return fromString(name, ExecutionStatus.class); + } + + /** + * Gets known ExecutionStatus values. + * + * @return known ExecutionStatus values. + */ + public static Collection values() { + return values(ExecutionStatus.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FastProvisioningEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FastProvisioningEditionCapability.java index fa240f037e0eb..e9e89dd7eda37 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FastProvisioningEditionCapability.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FastProvisioningEditionCapability.java @@ -7,9 +7,15 @@ import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** The FastProvisioningEditionCapability model. */ +/** Represents capability of a fast provisioning edition. */ @Immutable -public final class FastProvisioningEditionCapability { +public final class FastProvisioningEditionCapability extends CapabilityBase { + /* + * Fast provisioning supported tier name + */ + @JsonProperty(value = "supportedTier", access = JsonProperty.Access.WRITE_ONLY) + private String supportedTier; + /* * Fast provisioning supported sku name */ @@ -20,7 +26,7 @@ public final class FastProvisioningEditionCapability { * Fast provisioning supported storage in Gb */ @JsonProperty(value = "supportedStorageGb", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedStorageGb; + private Integer supportedStorageGb; /* * Fast provisioning supported version @@ -28,10 +34,25 @@ public final class FastProvisioningEditionCapability { @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) private String supportedServerVersions; + /* + * Count of servers in cache matching the spec + */ + @JsonProperty(value = "serverCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer serverCount; + /** Creates an instance of FastProvisioningEditionCapability class. */ public FastProvisioningEditionCapability() { } + /** + * Get the supportedTier property: Fast provisioning supported tier name. + * + * @return the supportedTier value. + */ + public String supportedTier() { + return this.supportedTier; + } + /** * Get the supportedSku property: Fast provisioning supported sku name. * @@ -46,7 +67,7 @@ public String supportedSku() { * * @return the supportedStorageGb value. */ - public Long supportedStorageGb() { + public Integer supportedStorageGb() { return this.supportedStorageGb; } @@ -59,11 +80,22 @@ public String supportedServerVersions() { return this.supportedServerVersions; } + /** + * Get the serverCount property: Count of servers in cache matching the spec. + * + * @return the serverCount value. + */ + public Integer serverCount() { + return this.serverCount; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { + super.validate(); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FastProvisioningSupportedEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FastProvisioningSupportedEnum.java new file mode 100644 index 0000000000000..e70abdebbf762 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FastProvisioningSupportedEnum.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Gets a value indicating whether fast provisioning is supported. "Enabled" means fast provisioning is supported. + * "Disabled" stands for fast provisioning is not supported. + */ +public final class FastProvisioningSupportedEnum extends ExpandableStringEnum { + /** Static value Enabled for FastProvisioningSupportedEnum. */ + public static final FastProvisioningSupportedEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for FastProvisioningSupportedEnum. */ + public static final FastProvisioningSupportedEnum DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of FastProvisioningSupportedEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FastProvisioningSupportedEnum() { + } + + /** + * Creates or finds a FastProvisioningSupportedEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding FastProvisioningSupportedEnum. + */ + @JsonCreator + public static FastProvisioningSupportedEnum fromString(String name) { + return fromString(name, FastProvisioningSupportedEnum.class); + } + + /** + * Gets known FastProvisioningSupportedEnum values. + * + * @return known FastProvisioningSupportedEnum values. + */ + public static Collection values() { + return values(FastProvisioningSupportedEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerCapability.java new file mode 100644 index 0000000000000..b7e81d26ee4c6 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerCapability.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner; +import java.util.List; + +/** An immutable client-side representation of FlexibleServerCapability. */ +public interface FlexibleServerCapability { + /** + * Gets the status property: The status of the capability. + * + * @return the status value. + */ + CapabilityStatus status(); + + /** + * Gets the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the name property: Name of flexible servers capability. + * + * @return the name value. + */ + String name(); + + /** + * Gets the supportedServerEditions property: List of supported flexible server editions. + * + * @return the supportedServerEditions value. + */ + List supportedServerEditions(); + + /** + * Gets the supportedServerVersions property: The list of server versions supported for this capability. + * + * @return the supportedServerVersions value. + */ + List supportedServerVersions(); + + /** + * Gets the fastProvisioningSupported property: Gets a value indicating whether fast provisioning is supported. + * "Enabled" means fast provisioning is supported. "Disabled" stands for fast provisioning is not supported. + * + * @return the fastProvisioningSupported value. + */ + FastProvisioningSupportedEnum fastProvisioningSupported(); + + /** + * Gets the supportedFastProvisioningEditions property: List of supported server editions for fast provisioning. + * + * @return the supportedFastProvisioningEditions value. + */ + List supportedFastProvisioningEditions(); + + /** + * Gets the geoBackupSupported property: Determines if geo-backup is supported in this region. "Enabled" means + * geo-backup is supported. "Disabled" stands for geo-back is not supported. + * + * @return the geoBackupSupported value. + */ + GeoBackupSupportedEnum geoBackupSupported(); + + /** + * Gets the zoneRedundantHaSupported property: A value indicating whether Zone Redundant HA is supported in this + * region. "Enabled" means zone redundant HA is supported. "Disabled" stands for zone redundant HA is not supported. + * + * @return the zoneRedundantHaSupported value. + */ + ZoneRedundantHaSupportedEnum zoneRedundantHaSupported(); + + /** + * Gets the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether Zone Redundant HA and + * Geo-backup is supported in this region. "Enabled" means zone redundant HA and geo-backup is supported. "Disabled" + * stands for zone redundant HA and geo-backup is not supported. + * + * @return the zoneRedundantHaAndGeoBackupSupported value. + */ + ZoneRedundantHaAndGeoBackupSupportedEnum zoneRedundantHaAndGeoBackupSupported(); + + /** + * Gets the storageAutoGrowthSupported property: A value indicating whether storage auto-grow is supported in this + * region. "Enabled" means storage auto-grow is supported. "Disabled" stands for storage auto-grow is not supported. + * + * @return the storageAutoGrowthSupported value. + */ + StorageAutoGrowthSupportedEnum storageAutoGrowthSupported(); + + /** + * Gets the onlineResizeSupported property: A value indicating whether online resize is supported in this region for + * the given subscription. "Enabled" means storage online resize is supported. "Disabled" means storage online + * resize is not supported. + * + * @return the onlineResizeSupported value. + */ + OnlineResizeSupportedEnum onlineResizeSupported(); + + /** + * Gets the restricted property: A value indicating whether this region is restricted. "Enabled" means region is + * restricted. "Disabled" stands for region is not restricted. + * + * @return the restricted value. + */ + RestrictedEnum restricted(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FlexibleServerCapabilityInner + * object. + * + * @return the inner object. + */ + FlexibleServerCapabilityInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java index bbf34878e9a3e..111485460147b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java @@ -10,7 +10,7 @@ /** Flexible server edition capabilities. */ @Immutable -public final class FlexibleServerEditionCapability { +public final class FlexibleServerEditionCapability extends CapabilityBase { /* * Server edition name */ @@ -18,22 +18,22 @@ public final class FlexibleServerEditionCapability { private String name; /* - * The list of editions supported by this server edition. + * Default sku name for the server edition */ - @JsonProperty(value = "supportedStorageEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageEditions; + @JsonProperty(value = "defaultSkuName", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSkuName; /* - * The list of server versions supported by this server edition. + * The list of editions supported by this server edition. */ - @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedServerVersions; + @JsonProperty(value = "supportedStorageEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageEditions; /* - * The status + * List of supported server SKUs. */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; + @JsonProperty(value = "supportedServerSkus", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServerSkus; /** Creates an instance of FlexibleServerEditionCapability class. */ public FlexibleServerEditionCapability() { @@ -49,30 +49,30 @@ public String name() { } /** - * Get the supportedStorageEditions property: The list of editions supported by this server edition. + * Get the defaultSkuName property: Default sku name for the server edition. * - * @return the supportedStorageEditions value. + * @return the defaultSkuName value. */ - public List supportedStorageEditions() { - return this.supportedStorageEditions; + public String defaultSkuName() { + return this.defaultSkuName; } /** - * Get the supportedServerVersions property: The list of server versions supported by this server edition. + * Get the supportedStorageEditions property: The list of editions supported by this server edition. * - * @return the supportedServerVersions value. + * @return the supportedStorageEditions value. */ - public List supportedServerVersions() { - return this.supportedServerVersions; + public List supportedStorageEditions() { + return this.supportedStorageEditions; } /** - * Get the status property: The status. + * Get the supportedServerSkus property: List of supported server SKUs. * - * @return the status value. + * @return the supportedServerSkus value. */ - public String status() { - return this.status; + public List supportedServerSkus() { + return this.supportedServerSkus; } /** @@ -80,12 +80,14 @@ public String status() { * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { + super.validate(); if (supportedStorageEditions() != null) { supportedStorageEditions().forEach(e -> e.validate()); } - if (supportedServerVersions() != null) { - supportedServerVersions().forEach(e -> e.validate()); + if (supportedServerSkus() != null) { + supportedServerSkus().forEach(e -> e.validate()); } } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServers.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServers.java new file mode 100644 index 0000000000000..8a79ba6ac437a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServers.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of FlexibleServers. */ +public interface FlexibleServers { + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR pre-backup API call. + */ + Response triggerLtrPreBackupWithResponse( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters, Context context); + + /** + * PreBackup operation performs all the checks that are needed for the subsequent long term retention backup + * operation to succeed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR pre-backup API call. + */ + LtrPreBackupResponse triggerLtrPreBackup( + String resourceGroupName, String serverName, LtrPreBackupRequest parameters); + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for 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 response for the LTR backup API call. + */ + LtrBackupResponse startLtrBackup(String resourceGroupName, String serverName, LtrBackupRequest parameters); + + /** + * Start the Long Term Retention Backup operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters Request body for operation. + * @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 response for the LTR backup API call. + */ + LtrBackupResponse startLtrBackup( + String resourceGroupName, String serverName, LtrBackupRequest parameters, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServersTriggerLtrPreBackupHeaders.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServersTriggerLtrPreBackupHeaders.java new file mode 100644 index 0000000000000..2cbf8e015e4d0 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServersTriggerLtrPreBackupHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The FlexibleServersTriggerLtrPreBackupHeaders model. */ +@Fluent +public final class FlexibleServersTriggerLtrPreBackupHeaders { + /* + * The x-ms-request-id property. + */ + @JsonProperty(value = "x-ms-request-id") + private String xMsRequestId; + + private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of FlexibleServersTriggerLtrPreBackupHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public FlexibleServersTriggerLtrPreBackupHeaders(HttpHeaders rawHeaders) { + this.xMsRequestId = rawHeaders.getValue(X_MS_REQUEST_ID); + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String xMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the FlexibleServersTriggerLtrPreBackupHeaders object itself. + */ + public FlexibleServersTriggerLtrPreBackupHeaders withXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServersTriggerLtrPreBackupResponse.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServersTriggerLtrPreBackupResponse.java new file mode 100644 index 0000000000000..ec228ae985c4f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServersTriggerLtrPreBackupResponse.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrPreBackupResponseInner; + +/** Contains all response data for the triggerLtrPreBackup operation. */ +public final class FlexibleServersTriggerLtrPreBackupResponse + extends ResponseBase { + /** + * Creates an instance of FlexibleServersTriggerLtrPreBackupResponse. + * + * @param request the request which resulted in this FlexibleServersTriggerLtrPreBackupResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public FlexibleServersTriggerLtrPreBackupResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + LtrPreBackupResponseInner value, + FlexibleServersTriggerLtrPreBackupHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public LtrPreBackupResponseInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoBackupSupportedEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoBackupSupportedEnum.java new file mode 100644 index 0000000000000..1c93c7e5109cc --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoBackupSupportedEnum.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Determines if geo-backup is supported in this region. "Enabled" means geo-backup is supported. "Disabled" stands for + * geo-back is not supported. + */ +public final class GeoBackupSupportedEnum extends ExpandableStringEnum { + /** Static value Enabled for GeoBackupSupportedEnum. */ + public static final GeoBackupSupportedEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for GeoBackupSupportedEnum. */ + public static final GeoBackupSupportedEnum DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of GeoBackupSupportedEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GeoBackupSupportedEnum() { + } + + /** + * Creates or finds a GeoBackupSupportedEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding GeoBackupSupportedEnum. + */ + @JsonCreator + public static GeoBackupSupportedEnum fromString(String name) { + return fromString(name, GeoBackupSupportedEnum.class); + } + + /** + * Gets known GeoBackupSupportedEnum values. + * + * @return known GeoBackupSupportedEnum values. + */ + public static Collection values() { + return values(GeoBackupSupportedEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HaMode.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HaMode.java new file mode 100644 index 0000000000000..fca58226aebe8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HaMode.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** HA mode supported for a server. */ +public final class HaMode extends ExpandableStringEnum { + /** Static value SameZone for HaMode. */ + public static final HaMode SAME_ZONE = fromString("SameZone"); + + /** Static value ZoneRedundant for HaMode. */ + public static final HaMode ZONE_REDUNDANT = fromString("ZoneRedundant"); + + /** + * Creates a new instance of HaMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HaMode() { + } + + /** + * Creates or finds a HaMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding HaMode. + */ + @JsonCreator + public static HaMode fromString(String name) { + return fromString(name, HaMode.class); + } + + /** + * Gets known HaMode values. + * + * @return known HaMode values. + */ + public static Collection values() { + return values(HaMode.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java deleted file mode 100644 index ea708a9405bc2..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Hyperscale node edition capabilities. */ -@Immutable -public final class HyperscaleNodeEditionCapability { - /* - * Server edition name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The list of editions supported by this server edition. - */ - @JsonProperty(value = "supportedStorageEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageEditions; - - /* - * The list of server versions supported by this server edition. - */ - @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedServerVersions; - - /* - * The list of Node Types supported by this server edition. - */ - @JsonProperty(value = "supportedNodeTypes", access = JsonProperty.Access.WRITE_ONLY) - private List supportedNodeTypes; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** Creates an instance of HyperscaleNodeEditionCapability class. */ - public HyperscaleNodeEditionCapability() { - } - - /** - * Get the name property: Server edition name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedStorageEditions property: The list of editions supported by this server edition. - * - * @return the supportedStorageEditions value. - */ - public List supportedStorageEditions() { - return this.supportedStorageEditions; - } - - /** - * Get the supportedServerVersions property: The list of server versions supported by this server edition. - * - * @return the supportedServerVersions value. - */ - public List supportedServerVersions() { - return this.supportedServerVersions; - } - - /** - * Get the supportedNodeTypes property: The list of Node Types supported by this server edition. - * - * @return the supportedNodeTypes value. - */ - public List supportedNodeTypes() { - return this.supportedNodeTypes; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedStorageEditions() != null) { - supportedStorageEditions().forEach(e -> e.validate()); - } - if (supportedServerVersions() != null) { - supportedServerVersions().forEach(e -> e.validate()); - } - if (supportedNodeTypes() != null) { - supportedNodeTypes().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.java index f1be087b7a872..12effc9736f49 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** the types of identities associated with this resource; currently restricted to 'SystemAssigned and UserAssigned'. */ +/** the types of identities associated with this resource; currently restricted to 'None and UserAssigned'. */ public final class IdentityType extends ExpandableStringEnum { /** Static value None for IdentityType. */ public static final IdentityType NONE = fromString("None"); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/KeyStatusEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/KeyStatusEnum.java new file mode 100644 index 0000000000000..7efbb800fb60b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/KeyStatusEnum.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Primary encryption key status for Data encryption enabled server. */ +public final class KeyStatusEnum extends ExpandableStringEnum { + /** Static value Valid for KeyStatusEnum. */ + public static final KeyStatusEnum VALID = fromString("Valid"); + + /** Static value Invalid for KeyStatusEnum. */ + public static final KeyStatusEnum INVALID = fromString("Invalid"); + + /** + * Creates a new instance of KeyStatusEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KeyStatusEnum() { + } + + /** + * Creates or finds a KeyStatusEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyStatusEnum. + */ + @JsonCreator + public static KeyStatusEnum fromString(String name) { + return fromString(name, KeyStatusEnum.class); + } + + /** + * Gets known KeyStatusEnum values. + * + * @return known KeyStatusEnum values. + */ + public static Collection values() { + return values(KeyStatusEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java index 6bfff0e2ec681..5a09ca86905ed 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java @@ -19,7 +19,7 @@ public interface LocationBasedCapabilities { * @return capabilities at specified location in a given subscription as paginated response with {@link * PagedIterable}. */ - PagedIterable execute(String locationName); + PagedIterable execute(String locationName); /** * Get capabilities at specified location in a given subscription. @@ -32,5 +32,5 @@ public interface LocationBasedCapabilities { * @return capabilities at specified location in a given subscription as paginated response with {@link * PagedIterable}. */ - PagedIterable execute(String locationName, Context context); + PagedIterable execute(String locationName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFile.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFile.java new file mode 100644 index 0000000000000..3eb05f06ca72f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFile.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of LogFile. */ +public interface LogFile { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the createdTime property: Creation timestamp of the log file. + * + * @return the createdTime value. + */ + OffsetDateTime createdTime(); + + /** + * Gets the lastModifiedTime property: Last modified timestamp of the log file. + * + * @return the lastModifiedTime value. + */ + OffsetDateTime lastModifiedTime(); + + /** + * Gets the sizeInKb property: The size in kb of the logFile. + * + * @return the sizeInKb value. + */ + Long sizeInKb(); + + /** + * Gets the typePropertiesType property: Type of the log file. + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the url property: The url to download the log file from. + * + * @return the url value. + */ + String url(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner object. + * + * @return the inner object. + */ + LogFileInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFileListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFileListResult.java new file mode 100644 index 0000000000000..e6c789534ed66 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFileListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A List of logFiles. */ +@Fluent +public final class LogFileListResult { + /* + * The list of logFiles in a server + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of LogFileListResult class. */ + public LogFileListResult() { + } + + /** + * Get the value property: The list of logFiles in a server. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of logFiles in a server. + * + * @param value the value value to set. + * @return the LogFileListResult object itself. + */ + public LogFileListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the LogFileListResult object itself. + */ + public LogFileListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFiles.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFiles.java new file mode 100644 index 0000000000000..a64a3ffb907e8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFiles.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LogFiles. */ +public interface LogFiles { + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the server log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of logFiles as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogicalReplicationOnSourceDbEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogicalReplicationOnSourceDbEnum.java new file mode 100644 index 0000000000000..a0316139dd717 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogicalReplicationOnSourceDbEnum.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether to setup LogicalReplicationOnSourceDb, if needed. */ +public final class LogicalReplicationOnSourceDbEnum extends ExpandableStringEnum { + /** Static value True for LogicalReplicationOnSourceDbEnum. */ + public static final LogicalReplicationOnSourceDbEnum TRUE = fromString("True"); + + /** Static value False for LogicalReplicationOnSourceDbEnum. */ + public static final LogicalReplicationOnSourceDbEnum FALSE = fromString("False"); + + /** + * Creates a new instance of LogicalReplicationOnSourceDbEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LogicalReplicationOnSourceDbEnum() { + } + + /** + * Creates or finds a LogicalReplicationOnSourceDbEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding LogicalReplicationOnSourceDbEnum. + */ + @JsonCreator + public static LogicalReplicationOnSourceDbEnum fromString(String name) { + return fromString(name, LogicalReplicationOnSourceDbEnum.class); + } + + /** + * Gets known LogicalReplicationOnSourceDbEnum values. + * + * @return known LogicalReplicationOnSourceDbEnum values. + */ + public static Collection values() { + return values(LogicalReplicationOnSourceDbEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrBackupOperations.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrBackupOperations.java new file mode 100644 index 0000000000000..542489de3eefd --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrBackupOperations.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of LtrBackupOperations. */ +public interface LtrBackupOperations { + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @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 result of the give long term retention backup operation for the flexible server along with {@link + * Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String backupName, Context context); + + /** + * Gets the result of the give long term retention backup operation for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param backupName The name of the backup. + * @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 result of the give long term retention backup operation for the flexible server. + */ + LtrServerBackupOperation get(String resourceGroupName, String serverName, String backupName); + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 result of the give long term retention backup operations for the flexible server as paginated + * response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the result of the give long term retention backup operations for the flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 result of the give long term retention backup operations for the flexible server as paginated + * response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrBackupRequest.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrBackupRequest.java new file mode 100644 index 0000000000000..62560eb37dc77 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrBackupRequest.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The request that is made for a long term retention backup. */ +@Fluent +public final class LtrBackupRequest extends BackupRequestBase { + /* + * Backup store detail for target server + */ + @JsonProperty(value = "targetDetails", required = true) + private BackupStoreDetails targetDetails; + + /** Creates an instance of LtrBackupRequest class. */ + public LtrBackupRequest() { + } + + /** + * Get the targetDetails property: Backup store detail for target server. + * + * @return the targetDetails value. + */ + public BackupStoreDetails targetDetails() { + return this.targetDetails; + } + + /** + * Set the targetDetails property: Backup store detail for target server. + * + * @param targetDetails the targetDetails value to set. + * @return the LtrBackupRequest object itself. + */ + public LtrBackupRequest withTargetDetails(BackupStoreDetails targetDetails) { + this.targetDetails = targetDetails; + return this; + } + + /** {@inheritDoc} */ + @Override + public LtrBackupRequest withBackupSettings(BackupSettings backupSettings) { + super.withBackupSettings(backupSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (targetDetails() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property targetDetails in model LtrBackupRequest")); + } else { + targetDetails().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LtrBackupRequest.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrBackupResponse.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrBackupResponse.java new file mode 100644 index 0000000000000..b9777abd55fb0 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrBackupResponse.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrBackupResponseInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of LtrBackupResponse. */ +public interface LtrBackupResponse { + /** + * Gets the datasourceSizeInBytes property: Size of datasource in bytes. + * + * @return the datasourceSizeInBytes value. + */ + Long datasourceSizeInBytes(); + + /** + * Gets the dataTransferredInBytes property: Data transferred in bytes. + * + * @return the dataTransferredInBytes value. + */ + Long dataTransferredInBytes(); + + /** + * Gets the backupName property: Name of Backup operation. + * + * @return the backupName value. + */ + String backupName(); + + /** + * Gets the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform + * a successful restore using this Recovery point. e.g. Versions, DataFormat etc. + * + * @return the backupMetadata value. + */ + String backupMetadata(); + + /** + * Gets the status property: Service-set extensible enum indicating the status of operation. + * + * @return the status value. + */ + ExecutionStatus status(); + + /** + * Gets the startTime property: Start time of the operation. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: End time of the operation. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the percentComplete property: PercentageCompleted. + * + * @return the percentComplete value. + */ + Double percentComplete(); + + /** + * Gets the errorCode property: The error code. + * + * @return the errorCode value. + */ + String errorCode(); + + /** + * Gets the errorMessage property: The error message. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrBackupResponseInner object. + * + * @return the inner object. + */ + LtrBackupResponseInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrPreBackupRequest.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrPreBackupRequest.java new file mode 100644 index 0000000000000..b81666148e389 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrPreBackupRequest.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; + +/** A request that is made for pre-backup. */ +@Fluent +public final class LtrPreBackupRequest extends BackupRequestBase { + /** Creates an instance of LtrPreBackupRequest class. */ + public LtrPreBackupRequest() { + } + + /** {@inheritDoc} */ + @Override + public LtrPreBackupRequest withBackupSettings(BackupSettings backupSettings) { + super.withBackupSettings(backupSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrPreBackupResponse.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrPreBackupResponse.java new file mode 100644 index 0000000000000..f1a043b44051d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrPreBackupResponse.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrPreBackupResponseInner; + +/** An immutable client-side representation of LtrPreBackupResponse. */ +public interface LtrPreBackupResponse { + /** + * Gets the numberOfContainers property: Number of storage containers the plugin will use during backup. More than + * one containers may be used for size limitations, parallelism, or redundancy etc. + * + * @return the numberOfContainers value. + */ + int numberOfContainers(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrPreBackupResponseInner object. + * + * @return the inner object. + */ + LtrPreBackupResponseInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrServerBackupOperation.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrServerBackupOperation.java new file mode 100644 index 0000000000000..4ce2506b20cdb --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrServerBackupOperation.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrServerBackupOperationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of LtrServerBackupOperation. */ +public interface LtrServerBackupOperation { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the datasourceSizeInBytes property: Size of datasource in bytes. + * + * @return the datasourceSizeInBytes value. + */ + Long datasourceSizeInBytes(); + + /** + * Gets the dataTransferredInBytes property: Data transferred in bytes. + * + * @return the dataTransferredInBytes value. + */ + Long dataTransferredInBytes(); + + /** + * Gets the backupName property: Name of Backup operation. + * + * @return the backupName value. + */ + String backupName(); + + /** + * Gets the backupMetadata property: Metadata to be stored in RP. Store everything that will be required to perform + * a successful restore using this Recovery point. e.g. Versions, DataFormat etc. + * + * @return the backupMetadata value. + */ + String backupMetadata(); + + /** + * Gets the status property: Service-set extensible enum indicating the status of operation. + * + * @return the status value. + */ + ExecutionStatus status(); + + /** + * Gets the startTime property: Start time of the operation. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: End time of the operation. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the percentComplete property: PercentageCompleted. + * + * @return the percentComplete value. + */ + Double percentComplete(); + + /** + * Gets the errorCode property: The error code. + * + * @return the errorCode value. + */ + String errorCode(); + + /** + * Gets the errorMessage property: The error message. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrServerBackupOperationInner + * object. + * + * @return the inner object. + */ + LtrServerBackupOperationInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrServerBackupOperationList.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrServerBackupOperationList.java new file mode 100644 index 0000000000000..ce0807dbab2b5 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LtrServerBackupOperationList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LtrServerBackupOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention backup operations for server. */ +@Fluent +public final class LtrServerBackupOperationList { + /* + * The list of long term retention server backup operations + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of LtrServerBackupOperationList class. */ + public LtrServerBackupOperationList() { + } + + /** + * Get the value property: The list of long term retention server backup operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of long term retention server backup operations. + * + * @param value the value value to set. + * @return the LtrServerBackupOperationList object itself. + */ + public LtrServerBackupOperationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the LtrServerBackupOperationList object itself. + */ + public LtrServerBackupOperationList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationListFilter.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationListFilter.java new file mode 100644 index 0000000000000..4fb1a3ed6d28d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationListFilter.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MigrationListFilter. */ +public final class MigrationListFilter extends ExpandableStringEnum { + /** Static value Active for MigrationListFilter. */ + public static final MigrationListFilter ACTIVE = fromString("Active"); + + /** Static value All for MigrationListFilter. */ + public static final MigrationListFilter ALL = fromString("All"); + + /** + * Creates a new instance of MigrationListFilter value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrationListFilter() { + } + + /** + * Creates or finds a MigrationListFilter from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrationListFilter. + */ + @JsonCreator + public static MigrationListFilter fromString(String name) { + return fromString(name, MigrationListFilter.class); + } + + /** + * Gets known MigrationListFilter values. + * + * @return known MigrationListFilter values. + */ + public static Collection values() { + return values(MigrationListFilter.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationMode.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationMode.java new file mode 100644 index 0000000000000..f1203e1e3f47e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationMode.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** There are two types of migration modes Online and Offline. */ +public final class MigrationMode extends ExpandableStringEnum { + /** Static value Offline for MigrationMode. */ + public static final MigrationMode OFFLINE = fromString("Offline"); + + /** Static value Online for MigrationMode. */ + public static final MigrationMode ONLINE = fromString("Online"); + + /** + * Creates a new instance of MigrationMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrationMode() { + } + + /** + * Creates or finds a MigrationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrationMode. + */ + @JsonCreator + public static MigrationMode fromString(String name) { + return fromString(name, MigrationMode.class); + } + + /** + * Gets known MigrationMode values. + * + * @return known MigrationMode values. + */ + public static Collection values() { + return values(MigrationMode.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationNameAvailabilityReason.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationNameAvailabilityReason.java new file mode 100644 index 0000000000000..21a0c21466ea3 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationNameAvailabilityReason.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Migration name availability reason. */ +public final class MigrationNameAvailabilityReason extends ExpandableStringEnum { + /** Static value Invalid for MigrationNameAvailabilityReason. */ + public static final MigrationNameAvailabilityReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for MigrationNameAvailabilityReason. */ + public static final MigrationNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of MigrationNameAvailabilityReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrationNameAvailabilityReason() { + } + + /** + * Creates or finds a MigrationNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrationNameAvailabilityReason. + */ + @JsonCreator + public static MigrationNameAvailabilityReason fromString(String name) { + return fromString(name, MigrationNameAvailabilityReason.class); + } + + /** + * Gets known MigrationNameAvailabilityReason values. + * + * @return known MigrationNameAvailabilityReason values. + */ + public static Collection values() { + return values(MigrationNameAvailabilityReason.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationNameAvailabilityResource.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationNameAvailabilityResource.java new file mode 100644 index 0000000000000..08f23000d0c5b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationNameAvailabilityResource.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationNameAvailabilityResourceInner; + +/** An immutable client-side representation of MigrationNameAvailabilityResource. */ +public interface MigrationNameAvailabilityResource { + /** + * Gets the name property: The resource name to verify. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the nameAvailable property: Indicates whether the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: Migration name availability reason. + * + * @return the reason value. + */ + MigrationNameAvailabilityReason reason(); + + /** + * Gets the message property: Migration name availability message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner + * com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationNameAvailabilityResourceInner object. + * + * @return the inner object. + */ + MigrationNameAvailabilityResourceInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationResource.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationResource.java new file mode 100644 index 0000000000000..f46fca71b1876 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationResource.java @@ -0,0 +1,714 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationResourceInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of MigrationResource. */ +public interface MigrationResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the migrationId property: ID for migration, a GUID. + * + * @return the migrationId value. + */ + String migrationId(); + + /** + * Gets the currentStatus property: Current status of migration. + * + * @return the currentStatus value. + */ + MigrationStatus currentStatus(); + + /** + * Gets the migrationMode property: There are two types of migration modes Online and Offline. + * + * @return the migrationMode value. + */ + MigrationMode migrationMode(); + + /** + * Gets the sourceDbServerMetadata property: Metadata of the source database server. + * + * @return the sourceDbServerMetadata value. + */ + DbServerMetadata sourceDbServerMetadata(); + + /** + * Gets the targetDbServerMetadata property: Metadata of the target database server. + * + * @return the targetDbServerMetadata value. + */ + DbServerMetadata targetDbServerMetadata(); + + /** + * Gets the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @return the sourceDbServerResourceId value. + */ + String sourceDbServerResourceId(); + + /** + * Gets the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name or ip. It is + * a optional value, if customer provide it, dms will always use it for connection. + * + * @return the sourceDbServerFullyQualifiedDomainName value. + */ + String sourceDbServerFullyQualifiedDomainName(); + + /** + * Gets the targetDbServerResourceId property: ResourceId of the source database server. + * + * @return the targetDbServerResourceId value. + */ + String targetDbServerResourceId(); + + /** + * Gets the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name or ip. It is + * a optional value, if customer provide it, dms will always use it for connection. + * + * @return the targetDbServerFullyQualifiedDomainName value. + */ + String targetDbServerFullyQualifiedDomainName(); + + /** + * Gets the secretParameters property: Migration secret parameters. + * + * @return the secretParameters value. + */ + MigrationSecretParameters secretParameters(); + + /** + * Gets the dbsToMigrate property: Number of databases to migrate. + * + * @return the dbsToMigrate value. + */ + List dbsToMigrate(); + + /** + * Gets the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @return the setupLogicalReplicationOnSourceDbIfNeeded value. + */ + LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded(); + + /** + * Gets the overwriteDbsInTarget property: Indicates whether the databases on the target server can be overwritten, + * if already present. If set to False, the migration workflow will wait for a confirmation, if it detects that the + * database already exists. + * + * @return the overwriteDbsInTarget value. + */ + OverwriteDbsInTargetEnum overwriteDbsInTarget(); + + /** + * Gets the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @return the migrationWindowStartTimeInUtc value. + */ + OffsetDateTime migrationWindowStartTimeInUtc(); + + /** + * Gets the migrationWindowEndTimeInUtc property: End time in UTC for migration window. + * + * @return the migrationWindowEndTimeInUtc value. + */ + OffsetDateTime migrationWindowEndTimeInUtc(); + + /** + * Gets the startDataMigration property: Indicates whether the data migration should start right away. + * + * @return the startDataMigration value. + */ + StartDataMigrationEnum startDataMigration(); + + /** + * Gets the triggerCutover property: To trigger cutover for entire migration we need to send this flag as True. + * + * @return the triggerCutover value. + */ + TriggerCutoverEnum triggerCutover(); + + /** + * Gets the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases send + * triggerCutover flag as True and database names in this array. + * + * @return the dbsToTriggerCutoverOn value. + */ + List dbsToTriggerCutoverOn(); + + /** + * Gets the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @return the cancel value. + */ + CancelEnum cancel(); + + /** + * Gets the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases send cancel flag + * as True and database names in this array. + * + * @return the dbsToCancelMigrationOn value. + */ + List dbsToCancelMigrationOn(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationResourceInner object. + * + * @return the inner object. + */ + MigrationResourceInner innerModel(); + + /** The entirety of the MigrationResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The MigrationResource definition stages. */ + interface DefinitionStages { + /** The first stage of the MigrationResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the MigrationResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the MigrationResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies subscriptionId, resourceGroupName, targetDbServerName. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @return the next definition stage. + */ + WithCreate withExistingFlexibleServer( + String subscriptionId, String resourceGroupName, String targetDbServerName); + } + /** + * The stage of the MigrationResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithMigrationMode, + DefinitionStages.WithSourceDbServerResourceId, + DefinitionStages.WithSourceDbServerFullyQualifiedDomainName, + DefinitionStages.WithTargetDbServerFullyQualifiedDomainName, + DefinitionStages.WithSecretParameters, + DefinitionStages.WithDbsToMigrate, + DefinitionStages.WithSetupLogicalReplicationOnSourceDbIfNeeded, + DefinitionStages.WithOverwriteDbsInTarget, + DefinitionStages.WithMigrationWindowStartTimeInUtc, + DefinitionStages.WithMigrationWindowEndTimeInUtc, + DefinitionStages.WithStartDataMigration, + DefinitionStages.WithTriggerCutover, + DefinitionStages.WithDbsToTriggerCutoverOn, + DefinitionStages.WithCancel, + DefinitionStages.WithDbsToCancelMigrationOn { + /** + * Executes the create request. + * + * @return the created resource. + */ + MigrationResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MigrationResource create(Context context); + } + /** The stage of the MigrationResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the MigrationResource definition allowing to specify migrationMode. */ + interface WithMigrationMode { + /** + * Specifies the migrationMode property: There are two types of migration modes Online and Offline. + * + * @param migrationMode There are two types of migration modes Online and Offline. + * @return the next definition stage. + */ + WithCreate withMigrationMode(MigrationMode migrationMode); + } + /** The stage of the MigrationResource definition allowing to specify sourceDbServerResourceId. */ + interface WithSourceDbServerResourceId { + /** + * Specifies the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @param sourceDbServerResourceId ResourceId of the source database server. + * @return the next definition stage. + */ + WithCreate withSourceDbServerResourceId(String sourceDbServerResourceId); + } + /** The stage of the MigrationResource definition allowing to specify sourceDbServerFullyQualifiedDomainName. */ + interface WithSourceDbServerFullyQualifiedDomainName { + /** + * Specifies the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name + * or ip. It is a optional value, if customer provide it, dms will always use it for connection. + * + * @param sourceDbServerFullyQualifiedDomainName Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * @return the next definition stage. + */ + WithCreate withSourceDbServerFullyQualifiedDomainName(String sourceDbServerFullyQualifiedDomainName); + } + /** The stage of the MigrationResource definition allowing to specify targetDbServerFullyQualifiedDomainName. */ + interface WithTargetDbServerFullyQualifiedDomainName { + /** + * Specifies the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name + * or ip. It is a optional value, if customer provide it, dms will always use it for connection. + * + * @param targetDbServerFullyQualifiedDomainName Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * @return the next definition stage. + */ + WithCreate withTargetDbServerFullyQualifiedDomainName(String targetDbServerFullyQualifiedDomainName); + } + /** The stage of the MigrationResource definition allowing to specify secretParameters. */ + interface WithSecretParameters { + /** + * Specifies the secretParameters property: Migration secret parameters. + * + * @param secretParameters Migration secret parameters. + * @return the next definition stage. + */ + WithCreate withSecretParameters(MigrationSecretParameters secretParameters); + } + /** The stage of the MigrationResource definition allowing to specify dbsToMigrate. */ + interface WithDbsToMigrate { + /** + * Specifies the dbsToMigrate property: Number of databases to migrate. + * + * @param dbsToMigrate Number of databases to migrate. + * @return the next definition stage. + */ + WithCreate withDbsToMigrate(List dbsToMigrate); + } + /** + * The stage of the MigrationResource definition allowing to specify setupLogicalReplicationOnSourceDbIfNeeded. + */ + interface WithSetupLogicalReplicationOnSourceDbIfNeeded { + /** + * Specifies the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @param setupLogicalReplicationOnSourceDbIfNeeded Indicates whether to setup LogicalReplicationOnSourceDb, + * if needed. + * @return the next definition stage. + */ + WithCreate withSetupLogicalReplicationOnSourceDbIfNeeded( + LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded); + } + /** The stage of the MigrationResource definition allowing to specify overwriteDbsInTarget. */ + interface WithOverwriteDbsInTarget { + /** + * Specifies the overwriteDbsInTarget property: Indicates whether the databases on the target server can be + * overwritten, if already present. If set to False, the migration workflow will wait for a confirmation, if + * it detects that the database already exists.. + * + * @param overwriteDbsInTarget Indicates whether the databases on the target server can be overwritten, if + * already present. If set to False, the migration workflow will wait for a confirmation, if it detects + * that the database already exists. + * @return the next definition stage. + */ + WithCreate withOverwriteDbsInTarget(OverwriteDbsInTargetEnum overwriteDbsInTarget); + } + /** The stage of the MigrationResource definition allowing to specify migrationWindowStartTimeInUtc. */ + interface WithMigrationWindowStartTimeInUtc { + /** + * Specifies the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @param migrationWindowStartTimeInUtc Start time in UTC for migration window. + * @return the next definition stage. + */ + WithCreate withMigrationWindowStartTimeInUtc(OffsetDateTime migrationWindowStartTimeInUtc); + } + /** The stage of the MigrationResource definition allowing to specify migrationWindowEndTimeInUtc. */ + interface WithMigrationWindowEndTimeInUtc { + /** + * Specifies the migrationWindowEndTimeInUtc property: End time in UTC for migration window. + * + * @param migrationWindowEndTimeInUtc End time in UTC for migration window. + * @return the next definition stage. + */ + WithCreate withMigrationWindowEndTimeInUtc(OffsetDateTime migrationWindowEndTimeInUtc); + } + /** The stage of the MigrationResource definition allowing to specify startDataMigration. */ + interface WithStartDataMigration { + /** + * Specifies the startDataMigration property: Indicates whether the data migration should start right away. + * + * @param startDataMigration Indicates whether the data migration should start right away. + * @return the next definition stage. + */ + WithCreate withStartDataMigration(StartDataMigrationEnum startDataMigration); + } + /** The stage of the MigrationResource definition allowing to specify triggerCutover. */ + interface WithTriggerCutover { + /** + * Specifies the triggerCutover property: To trigger cutover for entire migration we need to send this flag + * as True. + * + * @param triggerCutover To trigger cutover for entire migration we need to send this flag as True. + * @return the next definition stage. + */ + WithCreate withTriggerCutover(TriggerCutoverEnum triggerCutover); + } + /** The stage of the MigrationResource definition allowing to specify dbsToTriggerCutoverOn. */ + interface WithDbsToTriggerCutoverOn { + /** + * Specifies the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases + * send triggerCutover flag as True and database names in this array. + * + * @param dbsToTriggerCutoverOn When you want to trigger cutover for specific databases send triggerCutover + * flag as True and database names in this array. + * @return the next definition stage. + */ + WithCreate withDbsToTriggerCutoverOn(List dbsToTriggerCutoverOn); + } + /** The stage of the MigrationResource definition allowing to specify cancel. */ + interface WithCancel { + /** + * Specifies the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @param cancel To trigger cancel for entire migration we need to send this flag as True. + * @return the next definition stage. + */ + WithCreate withCancel(CancelEnum cancel); + } + /** The stage of the MigrationResource definition allowing to specify dbsToCancelMigrationOn. */ + interface WithDbsToCancelMigrationOn { + /** + * Specifies the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases + * send cancel flag as True and database names in this array. + * + * @param dbsToCancelMigrationOn When you want to trigger cancel for specific databases send cancel flag as + * True and database names in this array. + * @return the next definition stage. + */ + WithCreate withDbsToCancelMigrationOn(List dbsToCancelMigrationOn); + } + } + /** + * Begins update for the MigrationResource resource. + * + * @return the stage of resource update. + */ + MigrationResource.Update update(); + + /** The template for MigrationResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSourceDbServerResourceId, + UpdateStages.WithSourceDbServerFullyQualifiedDomainName, + UpdateStages.WithTargetDbServerFullyQualifiedDomainName, + UpdateStages.WithSecretParameters, + UpdateStages.WithDbsToMigrate, + UpdateStages.WithSetupLogicalReplicationOnSourceDbIfNeeded, + UpdateStages.WithOverwriteDbsInTarget, + UpdateStages.WithMigrationWindowStartTimeInUtc, + UpdateStages.WithStartDataMigration, + UpdateStages.WithTriggerCutover, + UpdateStages.WithDbsToTriggerCutoverOn, + UpdateStages.WithCancel, + UpdateStages.WithDbsToCancelMigrationOn, + UpdateStages.WithMigrationMode { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MigrationResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MigrationResource apply(Context context); + } + /** The MigrationResource update stages. */ + interface UpdateStages { + /** The stage of the MigrationResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Application-specific metadata in the form of key-value pairs.. + * + * @param tags Application-specific metadata in the form of key-value pairs. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the MigrationResource update allowing to specify sourceDbServerResourceId. */ + interface WithSourceDbServerResourceId { + /** + * Specifies the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @param sourceDbServerResourceId ResourceId of the source database server. + * @return the next definition stage. + */ + Update withSourceDbServerResourceId(String sourceDbServerResourceId); + } + /** The stage of the MigrationResource update allowing to specify sourceDbServerFullyQualifiedDomainName. */ + interface WithSourceDbServerFullyQualifiedDomainName { + /** + * Specifies the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name + * or ip. It is a optional value, if customer provide it, dms will always use it for connection. + * + * @param sourceDbServerFullyQualifiedDomainName Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * @return the next definition stage. + */ + Update withSourceDbServerFullyQualifiedDomainName(String sourceDbServerFullyQualifiedDomainName); + } + /** The stage of the MigrationResource update allowing to specify targetDbServerFullyQualifiedDomainName. */ + interface WithTargetDbServerFullyQualifiedDomainName { + /** + * Specifies the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name + * or ip. It is a optional value, if customer provide it, dms will always use it for connection. + * + * @param targetDbServerFullyQualifiedDomainName Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * @return the next definition stage. + */ + Update withTargetDbServerFullyQualifiedDomainName(String targetDbServerFullyQualifiedDomainName); + } + /** The stage of the MigrationResource update allowing to specify secretParameters. */ + interface WithSecretParameters { + /** + * Specifies the secretParameters property: Migration secret parameters. + * + * @param secretParameters Migration secret parameters. + * @return the next definition stage. + */ + Update withSecretParameters(MigrationSecretParameters secretParameters); + } + /** The stage of the MigrationResource update allowing to specify dbsToMigrate. */ + interface WithDbsToMigrate { + /** + * Specifies the dbsToMigrate property: Number of databases to migrate. + * + * @param dbsToMigrate Number of databases to migrate. + * @return the next definition stage. + */ + Update withDbsToMigrate(List dbsToMigrate); + } + /** The stage of the MigrationResource update allowing to specify setupLogicalReplicationOnSourceDbIfNeeded. */ + interface WithSetupLogicalReplicationOnSourceDbIfNeeded { + /** + * Specifies the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @param setupLogicalReplicationOnSourceDbIfNeeded Indicates whether to setup LogicalReplicationOnSourceDb, + * if needed. + * @return the next definition stage. + */ + Update withSetupLogicalReplicationOnSourceDbIfNeeded( + LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded); + } + /** The stage of the MigrationResource update allowing to specify overwriteDbsInTarget. */ + interface WithOverwriteDbsInTarget { + /** + * Specifies the overwriteDbsInTarget property: Indicates whether the databases on the target server can be + * overwritten, if already present. If set to False, the migration workflow will wait for a confirmation, if + * it detects that the database already exists.. + * + * @param overwriteDbsInTarget Indicates whether the databases on the target server can be overwritten, if + * already present. If set to False, the migration workflow will wait for a confirmation, if it detects + * that the database already exists. + * @return the next definition stage. + */ + Update withOverwriteDbsInTarget(OverwriteDbsInTargetEnum overwriteDbsInTarget); + } + /** The stage of the MigrationResource update allowing to specify migrationWindowStartTimeInUtc. */ + interface WithMigrationWindowStartTimeInUtc { + /** + * Specifies the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @param migrationWindowStartTimeInUtc Start time in UTC for migration window. + * @return the next definition stage. + */ + Update withMigrationWindowStartTimeInUtc(OffsetDateTime migrationWindowStartTimeInUtc); + } + /** The stage of the MigrationResource update allowing to specify startDataMigration. */ + interface WithStartDataMigration { + /** + * Specifies the startDataMigration property: Indicates whether the data migration should start right away. + * + * @param startDataMigration Indicates whether the data migration should start right away. + * @return the next definition stage. + */ + Update withStartDataMigration(StartDataMigrationEnum startDataMigration); + } + /** The stage of the MigrationResource update allowing to specify triggerCutover. */ + interface WithTriggerCutover { + /** + * Specifies the triggerCutover property: To trigger cutover for entire migration we need to send this flag + * as True. + * + * @param triggerCutover To trigger cutover for entire migration we need to send this flag as True. + * @return the next definition stage. + */ + Update withTriggerCutover(TriggerCutoverEnum triggerCutover); + } + /** The stage of the MigrationResource update allowing to specify dbsToTriggerCutoverOn. */ + interface WithDbsToTriggerCutoverOn { + /** + * Specifies the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases + * send triggerCutover flag as True and database names in this array. + * + * @param dbsToTriggerCutoverOn When you want to trigger cutover for specific databases send triggerCutover + * flag as True and database names in this array. + * @return the next definition stage. + */ + Update withDbsToTriggerCutoverOn(List dbsToTriggerCutoverOn); + } + /** The stage of the MigrationResource update allowing to specify cancel. */ + interface WithCancel { + /** + * Specifies the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @param cancel To trigger cancel for entire migration we need to send this flag as True. + * @return the next definition stage. + */ + Update withCancel(CancelEnum cancel); + } + /** The stage of the MigrationResource update allowing to specify dbsToCancelMigrationOn. */ + interface WithDbsToCancelMigrationOn { + /** + * Specifies the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases + * send cancel flag as True and database names in this array. + * + * @param dbsToCancelMigrationOn When you want to trigger cancel for specific databases send cancel flag as + * True and database names in this array. + * @return the next definition stage. + */ + Update withDbsToCancelMigrationOn(List dbsToCancelMigrationOn); + } + /** The stage of the MigrationResource update allowing to specify migrationMode. */ + interface WithMigrationMode { + /** + * Specifies the migrationMode property: There are two types of migration modes Online and Offline. + * + * @param migrationMode There are two types of migration modes Online and Offline. + * @return the next definition stage. + */ + Update withMigrationMode(MigrationMode migrationMode); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MigrationResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MigrationResource refresh(Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationResourceForPatch.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationResourceForPatch.java new file mode 100644 index 0000000000000..1296edd76d9d4 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationResourceForPatch.java @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationResourcePropertiesForPatch; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Represents a migration resource for patch. */ +@Fluent +public final class MigrationResourceForPatch { + /* + * Migration resource properties. + */ + @JsonProperty(value = "properties") + private MigrationResourcePropertiesForPatch innerProperties; + + /* + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of MigrationResourceForPatch class. */ + public MigrationResourceForPatch() { + } + + /** + * Get the innerProperties property: Migration resource properties. + * + * @return the innerProperties value. + */ + private MigrationResourcePropertiesForPatch innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Application-specific metadata in the form of key-value pairs. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Application-specific metadata in the form of key-value pairs. + * + * @param tags the tags value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @return the sourceDbServerResourceId value. + */ + public String sourceDbServerResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDbServerResourceId(); + } + + /** + * Set the sourceDbServerResourceId property: ResourceId of the source database server. + * + * @param sourceDbServerResourceId the sourceDbServerResourceId value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withSourceDbServerResourceId(String sourceDbServerResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withSourceDbServerResourceId(sourceDbServerResourceId); + return this; + } + + /** + * Get the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @return the sourceDbServerFullyQualifiedDomainName value. + */ + public String sourceDbServerFullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDbServerFullyQualifiedDomainName(); + } + + /** + * Set the sourceDbServerFullyQualifiedDomainName property: Source server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @param sourceDbServerFullyQualifiedDomainName the sourceDbServerFullyQualifiedDomainName value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withSourceDbServerFullyQualifiedDomainName( + String sourceDbServerFullyQualifiedDomainName) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withSourceDbServerFullyQualifiedDomainName(sourceDbServerFullyQualifiedDomainName); + return this; + } + + /** + * Get the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @return the targetDbServerFullyQualifiedDomainName value. + */ + public String targetDbServerFullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().targetDbServerFullyQualifiedDomainName(); + } + + /** + * Set the targetDbServerFullyQualifiedDomainName property: Target server fully qualified domain name or ip. It is a + * optional value, if customer provide it, dms will always use it for connection. + * + * @param targetDbServerFullyQualifiedDomainName the targetDbServerFullyQualifiedDomainName value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withTargetDbServerFullyQualifiedDomainName( + String targetDbServerFullyQualifiedDomainName) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withTargetDbServerFullyQualifiedDomainName(targetDbServerFullyQualifiedDomainName); + return this; + } + + /** + * Get the secretParameters property: Migration secret parameters. + * + * @return the secretParameters value. + */ + public MigrationSecretParameters secretParameters() { + return this.innerProperties() == null ? null : this.innerProperties().secretParameters(); + } + + /** + * Set the secretParameters property: Migration secret parameters. + * + * @param secretParameters the secretParameters value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withSecretParameters(MigrationSecretParameters secretParameters) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withSecretParameters(secretParameters); + return this; + } + + /** + * Get the dbsToMigrate property: Number of databases to migrate. + * + * @return the dbsToMigrate value. + */ + public List dbsToMigrate() { + return this.innerProperties() == null ? null : this.innerProperties().dbsToMigrate(); + } + + /** + * Set the dbsToMigrate property: Number of databases to migrate. + * + * @param dbsToMigrate the dbsToMigrate value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withDbsToMigrate(List dbsToMigrate) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withDbsToMigrate(dbsToMigrate); + return this; + } + + /** + * Get the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @return the setupLogicalReplicationOnSourceDbIfNeeded value. + */ + public LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded() { + return this.innerProperties() == null + ? null + : this.innerProperties().setupLogicalReplicationOnSourceDbIfNeeded(); + } + + /** + * Set the setupLogicalReplicationOnSourceDbIfNeeded property: Indicates whether to setup + * LogicalReplicationOnSourceDb, if needed. + * + * @param setupLogicalReplicationOnSourceDbIfNeeded the setupLogicalReplicationOnSourceDbIfNeeded value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withSetupLogicalReplicationOnSourceDbIfNeeded( + LogicalReplicationOnSourceDbEnum setupLogicalReplicationOnSourceDbIfNeeded) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withSetupLogicalReplicationOnSourceDbIfNeeded(setupLogicalReplicationOnSourceDbIfNeeded); + return this; + } + + /** + * Get the overwriteDbsInTarget property: Indicates whether the databases on the target server can be overwritten, + * if already present. If set to False, the migration workflow will wait for a confirmation, if it detects that the + * database already exists. + * + * @return the overwriteDbsInTarget value. + */ + public OverwriteDbsInTargetEnum overwriteDbsInTarget() { + return this.innerProperties() == null ? null : this.innerProperties().overwriteDbsInTarget(); + } + + /** + * Set the overwriteDbsInTarget property: Indicates whether the databases on the target server can be overwritten, + * if already present. If set to False, the migration workflow will wait for a confirmation, if it detects that the + * database already exists. + * + * @param overwriteDbsInTarget the overwriteDbsInTarget value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withOverwriteDbsInTarget(OverwriteDbsInTargetEnum overwriteDbsInTarget) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withOverwriteDbsInTarget(overwriteDbsInTarget); + return this; + } + + /** + * Get the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @return the migrationWindowStartTimeInUtc value. + */ + public OffsetDateTime migrationWindowStartTimeInUtc() { + return this.innerProperties() == null ? null : this.innerProperties().migrationWindowStartTimeInUtc(); + } + + /** + * Set the migrationWindowStartTimeInUtc property: Start time in UTC for migration window. + * + * @param migrationWindowStartTimeInUtc the migrationWindowStartTimeInUtc value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withMigrationWindowStartTimeInUtc(OffsetDateTime migrationWindowStartTimeInUtc) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withMigrationWindowStartTimeInUtc(migrationWindowStartTimeInUtc); + return this; + } + + /** + * Get the startDataMigration property: Indicates whether the data migration should start right away. + * + * @return the startDataMigration value. + */ + public StartDataMigrationEnum startDataMigration() { + return this.innerProperties() == null ? null : this.innerProperties().startDataMigration(); + } + + /** + * Set the startDataMigration property: Indicates whether the data migration should start right away. + * + * @param startDataMigration the startDataMigration value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withStartDataMigration(StartDataMigrationEnum startDataMigration) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withStartDataMigration(startDataMigration); + return this; + } + + /** + * Get the triggerCutover property: To trigger cutover for entire migration we need to send this flag as True. + * + * @return the triggerCutover value. + */ + public TriggerCutoverEnum triggerCutover() { + return this.innerProperties() == null ? null : this.innerProperties().triggerCutover(); + } + + /** + * Set the triggerCutover property: To trigger cutover for entire migration we need to send this flag as True. + * + * @param triggerCutover the triggerCutover value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withTriggerCutover(TriggerCutoverEnum triggerCutover) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withTriggerCutover(triggerCutover); + return this; + } + + /** + * Get the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases send + * triggerCutover flag as True and database names in this array. + * + * @return the dbsToTriggerCutoverOn value. + */ + public List dbsToTriggerCutoverOn() { + return this.innerProperties() == null ? null : this.innerProperties().dbsToTriggerCutoverOn(); + } + + /** + * Set the dbsToTriggerCutoverOn property: When you want to trigger cutover for specific databases send + * triggerCutover flag as True and database names in this array. + * + * @param dbsToTriggerCutoverOn the dbsToTriggerCutoverOn value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withDbsToTriggerCutoverOn(List dbsToTriggerCutoverOn) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withDbsToTriggerCutoverOn(dbsToTriggerCutoverOn); + return this; + } + + /** + * Get the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @return the cancel value. + */ + public CancelEnum cancel() { + return this.innerProperties() == null ? null : this.innerProperties().cancel(); + } + + /** + * Set the cancel property: To trigger cancel for entire migration we need to send this flag as True. + * + * @param cancel the cancel value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withCancel(CancelEnum cancel) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withCancel(cancel); + return this; + } + + /** + * Get the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases send cancel flag + * as True and database names in this array. + * + * @return the dbsToCancelMigrationOn value. + */ + public List dbsToCancelMigrationOn() { + return this.innerProperties() == null ? null : this.innerProperties().dbsToCancelMigrationOn(); + } + + /** + * Set the dbsToCancelMigrationOn property: When you want to trigger cancel for specific databases send cancel flag + * as True and database names in this array. + * + * @param dbsToCancelMigrationOn the dbsToCancelMigrationOn value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withDbsToCancelMigrationOn(List dbsToCancelMigrationOn) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withDbsToCancelMigrationOn(dbsToCancelMigrationOn); + return this; + } + + /** + * Get the migrationMode property: There are two types of migration modes Online and Offline. + * + * @return the migrationMode value. + */ + public MigrationMode migrationMode() { + return this.innerProperties() == null ? null : this.innerProperties().migrationMode(); + } + + /** + * Set the migrationMode property: There are two types of migration modes Online and Offline. + * + * @param migrationMode the migrationMode value to set. + * @return the MigrationResourceForPatch object itself. + */ + public MigrationResourceForPatch withMigrationMode(MigrationMode migrationMode) { + if (this.innerProperties() == null) { + this.innerProperties = new MigrationResourcePropertiesForPatch(); + } + this.innerProperties().withMigrationMode(migrationMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationResourceListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationResourceListResult.java new file mode 100644 index 0000000000000..13e03640ff072 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationResourceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of migration resources. */ +@Immutable +public final class MigrationResourceListResult { + /* + * A list of migration resources. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link used to get the next page of migrations. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of MigrationResourceListResult class. */ + public MigrationResourceListResult() { + } + + /** + * Get the value property: A list of migration resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link used to get the next page of migrations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationSecretParameters.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationSecretParameters.java new file mode 100644 index 0000000000000..d8acc7fd0ee32 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationSecretParameters.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Migration secret parameters. */ +@Fluent +public final class MigrationSecretParameters { + /* + * Admin credentials for source and target servers + */ + @JsonProperty(value = "adminCredentials", required = true) + private AdminCredentials adminCredentials; + + /* + * Gets or sets the username for the source server. This user need not be an admin. + */ + @JsonProperty(value = "sourceServerUsername") + private String sourceServerUsername; + + /* + * Gets or sets the username for the target server. This user need not be an admin. + */ + @JsonProperty(value = "targetServerUsername") + private String targetServerUsername; + + /** Creates an instance of MigrationSecretParameters class. */ + public MigrationSecretParameters() { + } + + /** + * Get the adminCredentials property: Admin credentials for source and target servers. + * + * @return the adminCredentials value. + */ + public AdminCredentials adminCredentials() { + return this.adminCredentials; + } + + /** + * Set the adminCredentials property: Admin credentials for source and target servers. + * + * @param adminCredentials the adminCredentials value to set. + * @return the MigrationSecretParameters object itself. + */ + public MigrationSecretParameters withAdminCredentials(AdminCredentials adminCredentials) { + this.adminCredentials = adminCredentials; + return this; + } + + /** + * Get the sourceServerUsername property: Gets or sets the username for the source server. This user need not be an + * admin. + * + * @return the sourceServerUsername value. + */ + public String sourceServerUsername() { + return this.sourceServerUsername; + } + + /** + * Set the sourceServerUsername property: Gets or sets the username for the source server. This user need not be an + * admin. + * + * @param sourceServerUsername the sourceServerUsername value to set. + * @return the MigrationSecretParameters object itself. + */ + public MigrationSecretParameters withSourceServerUsername(String sourceServerUsername) { + this.sourceServerUsername = sourceServerUsername; + return this; + } + + /** + * Get the targetServerUsername property: Gets or sets the username for the target server. This user need not be an + * admin. + * + * @return the targetServerUsername value. + */ + public String targetServerUsername() { + return this.targetServerUsername; + } + + /** + * Set the targetServerUsername property: Gets or sets the username for the target server. This user need not be an + * admin. + * + * @param targetServerUsername the targetServerUsername value to set. + * @return the MigrationSecretParameters object itself. + */ + public MigrationSecretParameters withTargetServerUsername(String targetServerUsername) { + this.targetServerUsername = targetServerUsername; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (adminCredentials() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property adminCredentials in model MigrationSecretParameters")); + } else { + adminCredentials().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MigrationSecretParameters.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationState.java new file mode 100644 index 0000000000000..fe217b3a12e70 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Migration state. */ +public final class MigrationState extends ExpandableStringEnum { + /** Static value InProgress for MigrationState. */ + public static final MigrationState IN_PROGRESS = fromString("InProgress"); + + /** Static value WaitingForUserAction for MigrationState. */ + public static final MigrationState WAITING_FOR_USER_ACTION = fromString("WaitingForUserAction"); + + /** Static value Canceled for MigrationState. */ + public static final MigrationState CANCELED = fromString("Canceled"); + + /** Static value Failed for MigrationState. */ + public static final MigrationState FAILED = fromString("Failed"); + + /** Static value Succeeded for MigrationState. */ + public static final MigrationState SUCCEEDED = fromString("Succeeded"); + + /** + * Creates a new instance of MigrationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrationState() { + } + + /** + * Creates or finds a MigrationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrationState. + */ + @JsonCreator + public static MigrationState fromString(String name) { + return fromString(name, MigrationState.class); + } + + /** + * Gets known MigrationState values. + * + * @return known MigrationState values. + */ + public static Collection values() { + return values(MigrationState.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationStatus.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationStatus.java new file mode 100644 index 0000000000000..cb25e1fd8a987 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationStatus.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Migration status. */ +@Immutable +public final class MigrationStatus { + /* + * State of migration + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private MigrationState state; + + /* + * Error message, if any, for the migration state + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private String error; + + /* + * Current Migration sub state details. + */ + @JsonProperty(value = "currentSubStateDetails", access = JsonProperty.Access.WRITE_ONLY) + private MigrationSubStateDetails currentSubStateDetails; + + /** Creates an instance of MigrationStatus class. */ + public MigrationStatus() { + } + + /** + * Get the state property: State of migration. + * + * @return the state value. + */ + public MigrationState state() { + return this.state; + } + + /** + * Get the error property: Error message, if any, for the migration state. + * + * @return the error value. + */ + public String error() { + return this.error; + } + + /** + * Get the currentSubStateDetails property: Current Migration sub state details. + * + * @return the currentSubStateDetails value. + */ + public MigrationSubStateDetails currentSubStateDetails() { + return this.currentSubStateDetails; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentSubStateDetails() != null) { + currentSubStateDetails().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationSubState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationSubState.java new file mode 100644 index 0000000000000..256542c6e0efb --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationSubState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Migration sub state. */ +public final class MigrationSubState extends ExpandableStringEnum { + /** Static value PerformingPreRequisiteSteps for MigrationSubState. */ + public static final MigrationSubState PERFORMING_PRE_REQUISITE_STEPS = fromString("PerformingPreRequisiteSteps"); + + /** Static value WaitingForLogicalReplicationSetupRequestOnSourceDB for MigrationSubState. */ + public static final MigrationSubState WAITING_FOR_LOGICAL_REPLICATION_SETUP_REQUEST_ON_SOURCE_DB = + fromString("WaitingForLogicalReplicationSetupRequestOnSourceDB"); + + /** Static value WaitingForDBsToMigrateSpecification for MigrationSubState. */ + public static final MigrationSubState WAITING_FOR_DBS_TO_MIGRATE_SPECIFICATION = + fromString("WaitingForDBsToMigrateSpecification"); + + /** Static value WaitingForTargetDBOverwriteConfirmation for MigrationSubState. */ + public static final MigrationSubState WAITING_FOR_TARGET_DBOVERWRITE_CONFIRMATION = + fromString("WaitingForTargetDBOverwriteConfirmation"); + + /** Static value WaitingForDataMigrationScheduling for MigrationSubState. */ + public static final MigrationSubState WAITING_FOR_DATA_MIGRATION_SCHEDULING = + fromString("WaitingForDataMigrationScheduling"); + + /** Static value WaitingForDataMigrationWindow for MigrationSubState. */ + public static final MigrationSubState WAITING_FOR_DATA_MIGRATION_WINDOW = + fromString("WaitingForDataMigrationWindow"); + + /** Static value MigratingData for MigrationSubState. */ + public static final MigrationSubState MIGRATING_DATA = fromString("MigratingData"); + + /** Static value WaitingForCutoverTrigger for MigrationSubState. */ + public static final MigrationSubState WAITING_FOR_CUTOVER_TRIGGER = fromString("WaitingForCutoverTrigger"); + + /** Static value CompletingMigration for MigrationSubState. */ + public static final MigrationSubState COMPLETING_MIGRATION = fromString("CompletingMigration"); + + /** Static value Completed for MigrationSubState. */ + public static final MigrationSubState COMPLETED = fromString("Completed"); + + /** + * Creates a new instance of MigrationSubState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrationSubState() { + } + + /** + * Creates or finds a MigrationSubState from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrationSubState. + */ + @JsonCreator + public static MigrationSubState fromString(String name) { + return fromString(name, MigrationSubState.class); + } + + /** + * Gets known MigrationSubState values. + * + * @return known MigrationSubState values. + */ + public static Collection values() { + return values(MigrationSubState.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationSubStateDetails.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationSubStateDetails.java new file mode 100644 index 0000000000000..315b1f622cc72 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MigrationSubStateDetails.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Migration sub state details. */ +@Immutable +public final class MigrationSubStateDetails { + /* + * Migration sub state. + */ + @JsonProperty(value = "currentSubState", access = JsonProperty.Access.WRITE_ONLY) + private MigrationSubState currentSubState; + + /** Creates an instance of MigrationSubStateDetails class. */ + public MigrationSubStateDetails() { + } + + /** + * Get the currentSubState property: Migration sub state. + * + * @return the currentSubState value. + */ + public MigrationSubState currentSubState() { + return this.currentSubState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Migrations.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Migrations.java new file mode 100644 index 0000000000000..a75d40fc38f4c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Migrations.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Migrations. */ +public interface Migrations { + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 details of a migration along with {@link Response}. + */ + Response getWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context); + + /** + * Gets details of a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 details of a migration. + */ + MigrationResource get( + String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName); + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @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 Response}. + */ + Response deleteWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + String migrationName, + Context context); + + /** + * Deletes a migration. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationName The name of the migration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String subscriptionId, String resourceGroupName, String targetDbServerName, String migrationName); + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTargetServer( + String subscriptionId, String resourceGroupName, String targetDbServerName); + + /** + * List all the migrations on a given target server. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param migrationListFilter Migration list filter. Retrieves either active migrations or all migrations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of migration resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTargetServer( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationListFilter migrationListFilter, + Context context); + + /** + * Gets details of a migration. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a migration along with {@link Response}. + */ + MigrationResource getById(String id); + + /** + * Gets details of a migration. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a migration along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a migration. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a migration. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MigrationResource resource. + * + * @param name resource name. + * @return the first stage of the new MigrationResource definition. + */ + MigrationResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java index 6ece01f4cd74c..e2607fb8a9038 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java @@ -17,13 +17,17 @@ public final class Network { private ServerPublicNetworkAccessState publicNetworkAccess; /* - * delegated subnet arm resource id. + * Delegated subnet arm resource id. This is required to be passed during create, in case we want the server to be + * VNET injected, i.e. Private access server. During update, pass this only if we want to update the value for + * Private DNS zone. */ @JsonProperty(value = "delegatedSubnetResourceId") private String delegatedSubnetResourceId; /* - * private dns zone arm resource id. + * Private dns zone arm resource id. This is required to be passed during create, in case we want the server to be + * VNET injected, i.e. Private access server. During update, pass this only if we want to update the value for + * Private DNS zone. */ @JsonProperty(value = "privateDnsZoneArmResourceId") private String privateDnsZoneArmResourceId; @@ -42,7 +46,9 @@ public ServerPublicNetworkAccessState publicNetworkAccess() { } /** - * Get the delegatedSubnetResourceId property: delegated subnet arm resource id. + * Get the delegatedSubnetResourceId property: Delegated subnet arm resource id. This is required to be passed + * during create, in case we want the server to be VNET injected, i.e. Private access server. During update, pass + * this only if we want to update the value for Private DNS zone. * * @return the delegatedSubnetResourceId value. */ @@ -51,7 +57,9 @@ public String delegatedSubnetResourceId() { } /** - * Set the delegatedSubnetResourceId property: delegated subnet arm resource id. + * Set the delegatedSubnetResourceId property: Delegated subnet arm resource id. This is required to be passed + * during create, in case we want the server to be VNET injected, i.e. Private access server. During update, pass + * this only if we want to update the value for Private DNS zone. * * @param delegatedSubnetResourceId the delegatedSubnetResourceId value to set. * @return the Network object itself. @@ -62,7 +70,9 @@ public Network withDelegatedSubnetResourceId(String delegatedSubnetResourceId) { } /** - * Get the privateDnsZoneArmResourceId property: private dns zone arm resource id. + * Get the privateDnsZoneArmResourceId property: Private dns zone arm resource id. This is required to be passed + * during create, in case we want the server to be VNET injected, i.e. Private access server. During update, pass + * this only if we want to update the value for Private DNS zone. * * @return the privateDnsZoneArmResourceId value. */ @@ -71,7 +81,9 @@ public String privateDnsZoneArmResourceId() { } /** - * Set the privateDnsZoneArmResourceId property: private dns zone arm resource id. + * Set the privateDnsZoneArmResourceId property: Private dns zone arm resource id. This is required to be passed + * during create, in case we want the server to be VNET injected, i.e. Private access server. During update, pass + * this only if we want to update the value for Private DNS zone. * * @param privateDnsZoneArmResourceId the privateDnsZoneArmResourceId value to set. * @return the Network object itself. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NodeTypeCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NodeTypeCapability.java deleted file mode 100644 index 023f95bd6df86..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NodeTypeCapability.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** node type capability. */ -@Immutable -public final class NodeTypeCapability { - /* - * note type name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * note type - */ - @JsonProperty(value = "nodeType", access = JsonProperty.Access.WRITE_ONLY) - private String nodeType; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** Creates an instance of NodeTypeCapability class. */ - public NodeTypeCapability() { - } - - /** - * Get the name property: note type name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the nodeType property: note type. - * - * @return the nodeType value. - */ - public String nodeType() { - return this.nodeType; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OnlineResizeSupportedEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OnlineResizeSupportedEnum.java new file mode 100644 index 0000000000000..71e6fe0ccd1f8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OnlineResizeSupportedEnum.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * A value indicating whether online resize is supported in this region for the given subscription. "Enabled" means + * storage online resize is supported. "Disabled" means storage online resize is not supported. + */ +public final class OnlineResizeSupportedEnum extends ExpandableStringEnum { + /** Static value Enabled for OnlineResizeSupportedEnum. */ + public static final OnlineResizeSupportedEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for OnlineResizeSupportedEnum. */ + public static final OnlineResizeSupportedEnum DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of OnlineResizeSupportedEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OnlineResizeSupportedEnum() { + } + + /** + * Creates or finds a OnlineResizeSupportedEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding OnlineResizeSupportedEnum. + */ + @JsonCreator + public static OnlineResizeSupportedEnum fromString(String name) { + return fromString(name, OnlineResizeSupportedEnum.class); + } + + /** + * Gets known OnlineResizeSupportedEnum values. + * + * @return known OnlineResizeSupportedEnum values. + */ + public static Collection values() { + return values(OnlineResizeSupportedEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OverwriteDbsInTargetEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OverwriteDbsInTargetEnum.java new file mode 100644 index 0000000000000..e2d42c5162cd0 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OverwriteDbsInTargetEnum.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Indicates whether the databases on the target server can be overwritten, if already present. If set to False, the + * migration workflow will wait for a confirmation, if it detects that the database already exists. + */ +public final class OverwriteDbsInTargetEnum extends ExpandableStringEnum { + /** Static value True for OverwriteDbsInTargetEnum. */ + public static final OverwriteDbsInTargetEnum TRUE = fromString("True"); + + /** Static value False for OverwriteDbsInTargetEnum. */ + public static final OverwriteDbsInTargetEnum FALSE = fromString("False"); + + /** + * Creates a new instance of OverwriteDbsInTargetEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OverwriteDbsInTargetEnum() { + } + + /** + * Creates or finds a OverwriteDbsInTargetEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding OverwriteDbsInTargetEnum. + */ + @JsonCreator + public static OverwriteDbsInTargetEnum fromString(String name) { + return fromString(name, OverwriteDbsInTargetEnum.class); + } + + /** + * Gets known OverwriteDbsInTargetEnum values. + * + * @return known OverwriteDbsInTargetEnum values. + */ + public static Collection values() { + return values(OverwriteDbsInTargetEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceProviders.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceProviders.java new file mode 100644 index 0000000000000..eb00ca559fc5e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceProviders.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationNameAvailabilityResourceInner; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability along with {@link Response}. + */ + Response checkMigrationNameAvailabilityWithResponse( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters, + Context context); + + /** + * Check migration name validity and availability + * + *

This method checks whether a proposed migration name is valid and available. + * + * @param subscriptionId The subscription ID of the target database server. + * @param resourceGroupName The resource group name of the target database server. + * @param targetDbServerName The name of the target database server. + * @param parameters The required parameters for checking if a migration name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a migration name's availability. + */ + MigrationNameAvailabilityResource checkMigrationNameAvailability( + String subscriptionId, + String resourceGroupName, + String targetDbServerName, + MigrationNameAvailabilityResourceInner parameters); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RestrictedEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RestrictedEnum.java new file mode 100644 index 0000000000000..41e759e9d661f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RestrictedEnum.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * A value indicating whether this region is restricted. "Enabled" means region is restricted. "Disabled" stands for + * region is not restricted. + */ +public final class RestrictedEnum extends ExpandableStringEnum { + /** Static value Enabled for RestrictedEnum. */ + public static final RestrictedEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for RestrictedEnum. */ + public static final RestrictedEnum DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of RestrictedEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RestrictedEnum() { + } + + /** + * Creates or finds a RestrictedEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestrictedEnum. + */ + @JsonCreator + public static RestrictedEnum fromString(String name) { + return fromString(name, RestrictedEnum.class); + } + + /** + * Gets known RestrictedEnum values. + * + * @return known RestrictedEnum values. + */ + public static Collection values() { + return values(RestrictedEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java index 517285ae4ece4..bf94d7e406cdf 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java @@ -141,7 +141,8 @@ public interface Server { Backup backup(); /** - * Gets the network property: Network properties of a server. + * Gets the network property: Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. * * @return the network value. */ @@ -163,7 +164,8 @@ public interface Server { /** * Gets the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This property is returned + * only for Replica server. * * @return the sourceServerResourceId value. */ @@ -171,7 +173,7 @@ public interface Server { /** * Gets the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'ReviveDropped'. * * @return the pointInTimeUtc value. */ @@ -294,7 +296,6 @@ interface WithCreate DefinitionStages.WithPointInTimeUtc, DefinitionStages.WithAvailabilityZone, DefinitionStages.WithReplicationRole, - DefinitionStages.WithReplicaCapacity, DefinitionStages.WithCreateMode { /** * Executes the create request. @@ -417,9 +418,11 @@ interface WithBackup { /** The stage of the Server definition allowing to specify network. */ interface WithNetwork { /** - * Specifies the network property: Network properties of a server.. + * Specifies the network property: Network properties of a server. This Network property is required to be + * passed only in case you want the server to be Private access server.. * - * @param network Network properties of a server. + * @param network Network properties of a server. This Network property is required to be passed only in + * case you want the server to be Private access server. * @return the next definition stage. */ WithCreate withNetwork(Network network); @@ -438,10 +441,12 @@ interface WithHighAvailability { interface WithSourceServerResourceId { /** * Specifies the sourceServerResourceId property: The source server resource ID to restore from. It's - * required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'.. + * required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This + * property is returned only for Replica server. * * @param sourceServerResourceId The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica'. + * 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This property + * is returned only for Replica server. * @return the next definition stage. */ WithCreate withSourceServerResourceId(String sourceServerResourceId); @@ -450,10 +455,11 @@ interface WithSourceServerResourceId { interface WithPointInTimeUtc { /** * Specifies the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time - * to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'.. + * to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or + * 'ReviveDropped'.. * * @param pointInTimeUtc Restore point creation time (ISO8601 format), specifying the time to restore from. - * It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore'. + * It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'ReviveDropped'. * @return the next definition stage. */ WithCreate withPointInTimeUtc(OffsetDateTime pointInTimeUtc); @@ -478,16 +484,6 @@ interface WithReplicationRole { */ WithCreate withReplicationRole(ReplicationRole replicationRole); } - /** The stage of the Server definition allowing to specify replicaCapacity. */ - interface WithReplicaCapacity { - /** - * Specifies the replicaCapacity property: Replicas allowed for a server.. - * - * @param replicaCapacity Replicas allowed for a server. - * @return the next definition stage. - */ - WithCreate withReplicaCapacity(Integer replicaCapacity); - } /** The stage of the Server definition allowing to specify createMode. */ interface WithCreateMode { /** @@ -520,7 +516,8 @@ interface Update UpdateStages.WithAuthConfig, UpdateStages.WithDataEncryption, UpdateStages.WithCreateMode, - UpdateStages.WithReplicationRole { + UpdateStages.WithReplicationRole, + UpdateStages.WithNetwork { /** * Executes the update request. * @@ -668,6 +665,18 @@ interface WithReplicationRole { */ Update withReplicationRole(ReplicationRole replicationRole); } + /** The stage of the Server update allowing to specify network. */ + interface WithNetwork { + /** + * Specifies the network property: Network properties of a server. These are required to be passed only in + * case if server is a private access server.. + * + * @param network Network properties of a server. These are required to be passed only in case if server is + * a private access server. + * @return the next definition stage. + */ + Update withNetwork(Network network); + } } /** * Refreshes the resource to sync with Azure. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerCapabilities.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerCapabilities.java new file mode 100644 index 0000000000000..b2368df76bd45 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerCapabilities.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ServerCapabilities. */ +public interface ServerCapabilities { + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 capabilities for a flexible server as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serverName); + + /** + * Get capabilities for a flexible server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 capabilities for a flexible server as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java index 596f50184b8c0..a3b904e33f744 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java @@ -341,6 +341,31 @@ public ServerForUpdate withReplicationRole(ReplicationRole replicationRole) { return this; } + /** + * Get the network property: Network properties of a server. These are required to be passed only in case if server + * is a private access server. + * + * @return the network value. + */ + public Network network() { + return this.innerProperties() == null ? null : this.innerProperties().network(); + } + + /** + * Set the network property: Network properties of a server. These are required to be passed only in case if server + * is a private access server. + * + * @param network the network value to set. + * @return the ServerForUpdate object itself. + */ + public ServerForUpdate withNetwork(Network network) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerPropertiesForUpdate(); + } + this.innerProperties().withNetwork(network); + return this; + } + /** * Validates the instance. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSku.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSku.java new file mode 100644 index 0000000000000..705969774b3ee --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSku.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Sku capability. */ +@Immutable +public final class ServerSku extends CapabilityBase { + /* + * Sku name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Supported vCores + */ + @JsonProperty(value = "vCores", access = JsonProperty.Access.WRITE_ONLY) + private Integer vCores; + + /* + * Supported IOPS + */ + @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) + private Integer supportedIops; + + /* + * Supported memory per vCore in MB + */ + @JsonProperty(value = "supportedMemoryPerVcoreMb", access = JsonProperty.Access.WRITE_ONLY) + private Long supportedMemoryPerVcoreMb; + + /* + * List of supported Availability Zones. E.g. "1", "2", "3" + */ + @JsonProperty(value = "supportedZones", access = JsonProperty.Access.WRITE_ONLY) + private List supportedZones; + + /* + * Supported high availability mode + */ + @JsonProperty(value = "supportedHaMode", access = JsonProperty.Access.WRITE_ONLY) + private List supportedHaMode; + + /** Creates an instance of ServerSku class. */ + public ServerSku() { + } + + /** + * Get the name property: Sku name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the vCores property: Supported vCores. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Get the supportedIops property: Supported IOPS. + * + * @return the supportedIops value. + */ + public Integer supportedIops() { + return this.supportedIops; + } + + /** + * Get the supportedMemoryPerVcoreMb property: Supported memory per vCore in MB. + * + * @return the supportedMemoryPerVcoreMb value. + */ + public Long supportedMemoryPerVcoreMb() { + return this.supportedMemoryPerVcoreMb; + } + + /** + * Get the supportedZones property: List of supported Availability Zones. E.g. "1", "2", "3". + * + * @return the supportedZones value. + */ + public List supportedZones() { + return this.supportedZones; + } + + /** + * Get the supportedHaMode property: Supported high availability mode. + * + * @return the supportedHaMode value. + */ + public List supportedHaMode() { + return this.supportedHaMode; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSkuAutoGenerated.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSkuAutoGenerated.java new file mode 100644 index 0000000000000..0508ab0df1b68 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSkuAutoGenerated.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Sku information related properties of a server. */ +@Fluent +public final class ServerSkuAutoGenerated { + /* + * The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The tier of the particular SKU, e.g. Burstable. + */ + @JsonProperty(value = "tier", required = true) + private SkuTier tier; + + /** Creates an instance of ServerSkuAutoGenerated class. */ + public ServerSkuAutoGenerated() { + } + + /** + * Get the name property: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + * + * @param name the name value to set. + * @return the ServerSkuAutoGenerated object itself. + */ + public ServerSkuAutoGenerated withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The tier of the particular SKU, e.g. Burstable. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: The tier of the particular SKU, e.g. Burstable. + * + * @param tier the tier value to set. + * @return the ServerSkuAutoGenerated object itself. + */ + public ServerSkuAutoGenerated withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ServerSkuAutoGenerated")); + } + if (tier() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property tier in model ServerSkuAutoGenerated")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerSkuAutoGenerated.class); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java index 84fce11b9595c..5cdd00caf372f 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java @@ -10,6 +10,9 @@ /** The version of a server. */ public final class ServerVersion extends ExpandableStringEnum { + /** Static value 15 for ServerVersion. */ + public static final ServerVersion ONE_FIVE = fromString("15"); + /** Static value 14 for ServerVersion. */ public static final ServerVersion ONE_FOUR = fromString("14"); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java index b8bc636074141..e40503bee92b9 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java @@ -10,9 +10,9 @@ /** Server version capabilities. */ @Immutable -public final class ServerVersionCapability { +public final class ServerVersionCapability extends CapabilityBase { /* - * server version + * Server version */ @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; @@ -23,24 +23,12 @@ public final class ServerVersionCapability { @JsonProperty(value = "supportedVersionsToUpgrade", access = JsonProperty.Access.WRITE_ONLY) private List supportedVersionsToUpgrade; - /* - * The supportedVcores property. - */ - @JsonProperty(value = "supportedVcores", access = JsonProperty.Access.WRITE_ONLY) - private List supportedVcores; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - /** Creates an instance of ServerVersionCapability class. */ public ServerVersionCapability() { } /** - * Get the name property: server version. + * Get the name property: Server version. * * @return the name value. */ @@ -57,32 +45,13 @@ public List supportedVersionsToUpgrade() { return this.supportedVersionsToUpgrade; } - /** - * Get the supportedVcores property: The supportedVcores property. - * - * @return the supportedVcores value. - */ - public List supportedVcores() { - return this.supportedVcores; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { - if (supportedVcores() != null) { - supportedVcores().forEach(e -> e.validate()); - } + super.validate(); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StartDataMigrationEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StartDataMigrationEnum.java new file mode 100644 index 0000000000000..d91827155d254 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StartDataMigrationEnum.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether the data migration should start right away. */ +public final class StartDataMigrationEnum extends ExpandableStringEnum { + /** Static value True for StartDataMigrationEnum. */ + public static final StartDataMigrationEnum TRUE = fromString("True"); + + /** Static value False for StartDataMigrationEnum. */ + public static final StartDataMigrationEnum FALSE = fromString("False"); + + /** + * Creates a new instance of StartDataMigrationEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StartDataMigrationEnum() { + } + + /** + * Creates or finds a StartDataMigrationEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding StartDataMigrationEnum. + */ + @JsonCreator + public static StartDataMigrationEnum fromString(String name) { + return fromString(name, StartDataMigrationEnum.class); + } + + /** + * Gets known StartDataMigrationEnum values. + * + * @return known StartDataMigrationEnum values. + */ + public static Collection values() { + return values(StartDataMigrationEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.java index 56fe534fcc197..9290783f88cf0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.java @@ -16,6 +16,24 @@ public final class Storage { @JsonProperty(value = "storageSizeGB") private Integer storageSizeGB; + /* + * Flag to enable / disable Storage Auto grow for flexible server. + */ + @JsonProperty(value = "autoGrow") + private StorageAutoGrow autoGrow; + + /* + * Name of storage tier for IOPS. + */ + @JsonProperty(value = "iopsTier") + private AzureManagedDiskPerformanceTiers iopsTier; + + /* + * Storage tier IOPS quantity. + */ + @JsonProperty(value = "iops", access = JsonProperty.Access.WRITE_ONLY) + private Integer iops; + /** Creates an instance of Storage class. */ public Storage() { } @@ -40,6 +58,55 @@ public Storage withStorageSizeGB(Integer storageSizeGB) { return this; } + /** + * Get the autoGrow property: Flag to enable / disable Storage Auto grow for flexible server. + * + * @return the autoGrow value. + */ + public StorageAutoGrow autoGrow() { + return this.autoGrow; + } + + /** + * Set the autoGrow property: Flag to enable / disable Storage Auto grow for flexible server. + * + * @param autoGrow the autoGrow value to set. + * @return the Storage object itself. + */ + public Storage withAutoGrow(StorageAutoGrow autoGrow) { + this.autoGrow = autoGrow; + return this; + } + + /** + * Get the iopsTier property: Name of storage tier for IOPS. + * + * @return the iopsTier value. + */ + public AzureManagedDiskPerformanceTiers iopsTier() { + return this.iopsTier; + } + + /** + * Set the iopsTier property: Name of storage tier for IOPS. + * + * @param iopsTier the iopsTier value to set. + * @return the Storage object itself. + */ + public Storage withIopsTier(AzureManagedDiskPerformanceTiers iopsTier) { + this.iopsTier = iopsTier; + return this; + } + + /** + * Get the iops property: Storage tier IOPS quantity. + * + * @return the iops value. + */ + public Integer iops() { + return this.iops; + } + /** * Validates the instance. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutoGrow.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutoGrow.java new file mode 100644 index 0000000000000..7e695076190f9 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutoGrow.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Flag to enable / disable Storage Auto grow for flexible server. */ +public final class StorageAutoGrow extends ExpandableStringEnum { + /** Static value Enabled for StorageAutoGrow. */ + public static final StorageAutoGrow ENABLED = fromString("Enabled"); + + /** Static value Disabled for StorageAutoGrow. */ + public static final StorageAutoGrow DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of StorageAutoGrow value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StorageAutoGrow() { + } + + /** + * Creates or finds a StorageAutoGrow from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageAutoGrow. + */ + @JsonCreator + public static StorageAutoGrow fromString(String name) { + return fromString(name, StorageAutoGrow.class); + } + + /** + * Gets known StorageAutoGrow values. + * + * @return known StorageAutoGrow values. + */ + public static Collection values() { + return values(StorageAutoGrow.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutoGrowthSupportedEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutoGrowthSupportedEnum.java new file mode 100644 index 0000000000000..eef0b91afcdf9 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutoGrowthSupportedEnum.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * A value indicating whether storage auto-grow is supported in this region. "Enabled" means storage auto-grow is + * supported. "Disabled" stands for storage auto-grow is not supported. + */ +public final class StorageAutoGrowthSupportedEnum extends ExpandableStringEnum { + /** Static value Enabled for StorageAutoGrowthSupportedEnum. */ + public static final StorageAutoGrowthSupportedEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for StorageAutoGrowthSupportedEnum. */ + public static final StorageAutoGrowthSupportedEnum DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of StorageAutoGrowthSupportedEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StorageAutoGrowthSupportedEnum() { + } + + /** + * Creates or finds a StorageAutoGrowthSupportedEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageAutoGrowthSupportedEnum. + */ + @JsonCreator + public static StorageAutoGrowthSupportedEnum fromString(String name) { + return fromString(name, StorageAutoGrowthSupportedEnum.class); + } + + /** + * Gets known StorageAutoGrowthSupportedEnum values. + * + * @return known StorageAutoGrowthSupportedEnum values. + */ + public static Collection values() { + return values(StorageAutoGrowthSupportedEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java index 150a603b884f5..eb8c97f5b6fc2 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java @@ -8,33 +8,33 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** storage edition capability. */ +/** Storage edition capability. */ @Immutable -public final class StorageEditionCapability { +public final class StorageEditionCapability extends CapabilityBase { /* - * storage edition name + * Storage edition name */ @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* - * The supportedStorageMB property. + * Default storage size in MB for storage edition */ - @JsonProperty(value = "supportedStorageMB", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageMB; + @JsonProperty(value = "defaultStorageSizeMb", access = JsonProperty.Access.WRITE_ONLY) + private Long defaultStorageSizeMb; /* - * The status + * Flexible server supported storage range in MB */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; + @JsonProperty(value = "supportedStorageMb", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageMb; /** Creates an instance of StorageEditionCapability class. */ public StorageEditionCapability() { } /** - * Get the name property: storage edition name. + * Get the name property: Storage edition name. * * @return the name value. */ @@ -43,21 +43,21 @@ public String name() { } /** - * Get the supportedStorageMB property: The supportedStorageMB property. + * Get the defaultStorageSizeMb property: Default storage size in MB for storage edition. * - * @return the supportedStorageMB value. + * @return the defaultStorageSizeMb value. */ - public List supportedStorageMB() { - return this.supportedStorageMB; + public Long defaultStorageSizeMb() { + return this.defaultStorageSizeMb; } /** - * Get the status property: The status. + * Get the supportedStorageMb property: Flexible server supported storage range in MB. * - * @return the status value. + * @return the supportedStorageMb value. */ - public String status() { - return this.status; + public List supportedStorageMb() { + return this.supportedStorageMb; } /** @@ -65,9 +65,11 @@ public String status() { * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { - if (supportedStorageMB() != null) { - supportedStorageMB().forEach(e -> e.validate()); + super.validate(); + if (supportedStorageMb() != null) { + supportedStorageMb().forEach(e -> e.validate()); } } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMBCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMBCapability.java deleted file mode 100644 index e1121c324498d..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMBCapability.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** storage size in MB capability. */ -@Immutable -public final class StorageMBCapability { - /* - * storage MB name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * supported IOPS - */ - @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedIops; - - /* - * storage size in MB - */ - @JsonProperty(value = "storageSizeMB", access = JsonProperty.Access.WRITE_ONLY) - private Long storageSizeMB; - - /* - * The supportedUpgradableTierList property. - */ - @JsonProperty(value = "supportedUpgradableTierList", access = JsonProperty.Access.WRITE_ONLY) - private List supportedUpgradableTierList; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** Creates an instance of StorageMBCapability class. */ - public StorageMBCapability() { - } - - /** - * Get the name property: storage MB name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedIops property: supported IOPS. - * - * @return the supportedIops value. - */ - public Long supportedIops() { - return this.supportedIops; - } - - /** - * Get the storageSizeMB property: storage size in MB. - * - * @return the storageSizeMB value. - */ - public Long storageSizeMB() { - return this.storageSizeMB; - } - - /** - * Get the supportedUpgradableTierList property: The supportedUpgradableTierList property. - * - * @return the supportedUpgradableTierList value. - */ - public List supportedUpgradableTierList() { - return this.supportedUpgradableTierList; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedUpgradableTierList() != null) { - supportedUpgradableTierList().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMbCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMbCapability.java new file mode 100644 index 0000000000000..cdd21dcb5eacd --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMbCapability.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** storage size in MB capability. */ +@Immutable +public final class StorageMbCapability extends CapabilityBase { + /* + * Supported IOPS + */ + @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) + private Integer supportedIops; + + /* + * Storage size in MB + */ + @JsonProperty(value = "storageSizeMb", access = JsonProperty.Access.WRITE_ONLY) + private Long storageSizeMb; + + /* + * Default tier for IOPS + */ + @JsonProperty(value = "defaultIopsTier", access = JsonProperty.Access.WRITE_ONLY) + private String defaultIopsTier; + + /* + * List of available options to upgrade the storage performance + */ + @JsonProperty(value = "supportedIopsTiers", access = JsonProperty.Access.WRITE_ONLY) + private List supportedIopsTiers; + + /** Creates an instance of StorageMbCapability class. */ + public StorageMbCapability() { + } + + /** + * Get the supportedIops property: Supported IOPS. + * + * @return the supportedIops value. + */ + public Integer supportedIops() { + return this.supportedIops; + } + + /** + * Get the storageSizeMb property: Storage size in MB. + * + * @return the storageSizeMb value. + */ + public Long storageSizeMb() { + return this.storageSizeMb; + } + + /** + * Get the defaultIopsTier property: Default tier for IOPS. + * + * @return the defaultIopsTier value. + */ + public String defaultIopsTier() { + return this.defaultIopsTier; + } + + /** + * Get the supportedIopsTiers property: List of available options to upgrade the storage performance. + * + * @return the supportedIopsTiers value. + */ + public List supportedIopsTiers() { + return this.supportedIopsTiers; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (supportedIopsTiers() != null) { + supportedIopsTiers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageTierCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageTierCapability.java index a4e018a6e3fac..f433cd56ca570 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageTierCapability.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageTierCapability.java @@ -7,38 +7,20 @@ import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** The StorageTierCapability model. */ +/** Represents capability of a storage tier. */ @Immutable -public final class StorageTierCapability { +public final class StorageTierCapability extends CapabilityBase { /* * Name to represent Storage tier capability */ @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; - /* - * Storage tier name - */ - @JsonProperty(value = "tierName", access = JsonProperty.Access.WRITE_ONLY) - private String tierName; - /* * Supported IOPS for this storage tier */ @JsonProperty(value = "iops", access = JsonProperty.Access.WRITE_ONLY) - private Long iops; - - /* - * Indicates if this is a baseline storage tier or not - */ - @JsonProperty(value = "isBaseline", access = JsonProperty.Access.WRITE_ONLY) - private Boolean isBaseline; - - /* - * Status os this storage tier - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; + private Integer iops; /** Creates an instance of StorageTierCapability class. */ public StorageTierCapability() { @@ -53,47 +35,22 @@ public String name() { return this.name; } - /** - * Get the tierName property: Storage tier name. - * - * @return the tierName value. - */ - public String tierName() { - return this.tierName; - } - /** * Get the iops property: Supported IOPS for this storage tier. * * @return the iops value. */ - public Long iops() { + public Integer iops() { return this.iops; } - /** - * Get the isBaseline property: Indicates if this is a baseline storage tier or not. - * - * @return the isBaseline value. - */ - public Boolean isBaseline() { - return this.isBaseline; - } - - /** - * Get the status property: Status os this storage tier. - * - * @return the status value. - */ - public String status() { - return this.status; - } - /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { + super.validate(); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/TriggerCutoverEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/TriggerCutoverEnum.java new file mode 100644 index 0000000000000..bb779718fe187 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/TriggerCutoverEnum.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** To trigger cutover for entire migration we need to send this flag as True. */ +public final class TriggerCutoverEnum extends ExpandableStringEnum { + /** Static value True for TriggerCutoverEnum. */ + public static final TriggerCutoverEnum TRUE = fromString("True"); + + /** Static value False for TriggerCutoverEnum. */ + public static final TriggerCutoverEnum FALSE = fromString("False"); + + /** + * Creates a new instance of TriggerCutoverEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TriggerCutoverEnum() { + } + + /** + * Creates or finds a TriggerCutoverEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding TriggerCutoverEnum. + */ + @JsonCreator + public static TriggerCutoverEnum fromString(String name) { + return fromString(name, TriggerCutoverEnum.class); + } + + /** + * Gets known TriggerCutoverEnum values. + * + * @return known TriggerCutoverEnum values. + */ + public static Collection values() { + return values(TriggerCutoverEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/UserAssignedIdentity.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/UserAssignedIdentity.java index f2c2a9f40bc33..d800d4c378b25 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/UserAssignedIdentity.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/UserAssignedIdentity.java @@ -21,7 +21,7 @@ public final class UserAssignedIdentity { private Map userAssignedIdentities; /* - * the types of identities associated with this resource; currently restricted to 'SystemAssigned and UserAssigned' + * the types of identities associated with this resource; currently restricted to 'None and UserAssigned' */ @JsonProperty(value = "type", required = true) private IdentityType type; @@ -51,8 +51,8 @@ public UserAssignedIdentity withUserAssignedIdentities(Map } /** - * Get the type property: the types of identities associated with this resource; currently restricted to - * 'SystemAssigned and UserAssigned'. + * Get the type property: the types of identities associated with this resource; currently restricted to 'None and + * UserAssigned'. * * @return the type value. */ @@ -61,8 +61,8 @@ public IdentityType type() { } /** - * Set the type property: the types of identities associated with this resource; currently restricted to - * 'SystemAssigned and UserAssigned'. + * Set the type property: the types of identities associated with this resource; currently restricted to 'None and + * UserAssigned'. * * @param type the type value to set. * @return the UserAssignedIdentity object itself. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VcoreCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VcoreCapability.java deleted file mode 100644 index 9fa8b25d8effb..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VcoreCapability.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Vcores capability. */ -@Immutable -public final class VcoreCapability { - /* - * vCore name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * supported vCores - */ - @JsonProperty(value = "vCores", access = JsonProperty.Access.WRITE_ONLY) - private Long vCores; - - /* - * supported IOPS - */ - @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedIops; - - /* - * supported memory per vCore in MB - */ - @JsonProperty(value = "supportedMemoryPerVcoreMB", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedMemoryPerVcoreMB; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** Creates an instance of VcoreCapability class. */ - public VcoreCapability() { - } - - /** - * Get the name property: vCore name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the vCores property: supported vCores. - * - * @return the vCores value. - */ - public Long vCores() { - return this.vCores; - } - - /** - * Get the supportedIops property: supported IOPS. - * - * @return the supportedIops value. - */ - public Long supportedIops() { - return this.supportedIops; - } - - /** - * Get the supportedMemoryPerVcoreMB property: supported memory per vCore in MB. - * - * @return the supportedMemoryPerVcoreMB value. - */ - public Long supportedMemoryPerVcoreMB() { - return this.supportedMemoryPerVcoreMB; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ZoneRedundantHaAndGeoBackupSupportedEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ZoneRedundantHaAndGeoBackupSupportedEnum.java new file mode 100644 index 0000000000000..296b49140f953 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ZoneRedundantHaAndGeoBackupSupportedEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * A value indicating whether Zone Redundant HA and Geo-backup is supported in this region. "Enabled" means zone + * redundant HA and geo-backup is supported. "Disabled" stands for zone redundant HA and geo-backup is not supported. + */ +public final class ZoneRedundantHaAndGeoBackupSupportedEnum + extends ExpandableStringEnum { + /** Static value Enabled for ZoneRedundantHaAndGeoBackupSupportedEnum. */ + public static final ZoneRedundantHaAndGeoBackupSupportedEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for ZoneRedundantHaAndGeoBackupSupportedEnum. */ + public static final ZoneRedundantHaAndGeoBackupSupportedEnum DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of ZoneRedundantHaAndGeoBackupSupportedEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ZoneRedundantHaAndGeoBackupSupportedEnum() { + } + + /** + * Creates or finds a ZoneRedundantHaAndGeoBackupSupportedEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ZoneRedundantHaAndGeoBackupSupportedEnum. + */ + @JsonCreator + public static ZoneRedundantHaAndGeoBackupSupportedEnum fromString(String name) { + return fromString(name, ZoneRedundantHaAndGeoBackupSupportedEnum.class); + } + + /** + * Gets known ZoneRedundantHaAndGeoBackupSupportedEnum values. + * + * @return known ZoneRedundantHaAndGeoBackupSupportedEnum values. + */ + public static Collection values() { + return values(ZoneRedundantHaAndGeoBackupSupportedEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ZoneRedundantHaSupportedEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ZoneRedundantHaSupportedEnum.java new file mode 100644 index 0000000000000..bd42da75ee949 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ZoneRedundantHaSupportedEnum.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * A value indicating whether Zone Redundant HA is supported in this region. "Enabled" means zone redundant HA is + * supported. "Disabled" stands for zone redundant HA is not supported. + */ +public final class ZoneRedundantHaSupportedEnum extends ExpandableStringEnum { + /** Static value Enabled for ZoneRedundantHaSupportedEnum. */ + public static final ZoneRedundantHaSupportedEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for ZoneRedundantHaSupportedEnum. */ + public static final ZoneRedundantHaSupportedEnum DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of ZoneRedundantHaSupportedEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ZoneRedundantHaSupportedEnum() { + } + + /** + * Creates or finds a ZoneRedundantHaSupportedEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ZoneRedundantHaSupportedEnum. + */ + @JsonCreator + public static ZoneRedundantHaSupportedEnum fromString(String name) { + return fromString(name, ZoneRedundantHaSupportedEnum.class); + } + + /** + * Gets known ZoneRedundantHaSupportedEnum values. + * + * @return known ZoneRedundantHaSupportedEnum values. + */ + public static Collection values() { + return values(ZoneRedundantHaSupportedEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsCreateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsCreateSamples.java index f5349c444453e..7723051b446a7 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsCreateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsCreateSamples.java @@ -9,7 +9,7 @@ /** Samples for Administrators Create. */ public final class AdministratorsCreateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/AdministratorAdd.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorAdd.json */ /** * Sample code: Adds an Active DIrectory Administrator for the server. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsDeleteSamples.java index 5796b304877fd..936079e83b100 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsDeleteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Administrators Delete. */ public final class AdministratorsDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/AdministratorDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorDelete.json */ /** * Sample code: AdministratorDelete. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsGetSamples.java index b1e85759ecd4c..2cc75cdb6810a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsGetSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for Administrators Get. */ public final class AdministratorsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/AdministratorGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorGet.json */ /** * Sample code: ServerGet. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsListByServerSamples.java index eea1e9d20b447..ea4bc3b1c6323 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsListByServerSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsListByServerSamples.java @@ -7,7 +7,7 @@ /** Samples for Administrators ListByServer. */ public final class AdministratorsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/AdministratorsListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorsListByServer.json */ /** * Sample code: AdministratorsListByServer. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsGetSamples.java index 962eea9909219..b407251cc791a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsGetSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for Backups Get. */ public final class BackupsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/BackupGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupGet.json */ /** * Sample code: Get a backup for a server. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsListByServerSamples.java index 46e415b711fd3..8e5746eb6157a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsListByServerSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsListByServerSamples.java @@ -7,7 +7,7 @@ /** Samples for Backups ListByServer. */ public final class BackupsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/BackupListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupListByServer.json */ /** * Sample code: List backups for a server. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java index b026fb4108c7a..375890b35f227 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java @@ -9,7 +9,7 @@ /** Samples for CheckNameAvailability Execute. */ public final class CheckNameAvailabilityExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/CheckNameAvailability.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckNameAvailability.json */ /** * Sample code: NameAvailability. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationExecuteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationExecuteSamples.java index d0ec62a103969..255acf241572f 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationExecuteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationExecuteSamples.java @@ -9,7 +9,7 @@ /** Samples for CheckNameAvailabilityWithLocation Execute. */ public final class CheckNameAvailabilityWithLocationExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/CheckNameAvailabilityLocationBased.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckNameAvailabilityLocationBased.json */ /** * Sample code: NameAvailability. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetSamples.java index db1602f3e0614..4bbab13267495 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for Configurations Get. */ public final class ConfigurationsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ConfigurationGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationGet.json */ /** * Sample code: ConfigurationGet. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java index fc79a7d7184eb..f885dd81f69a4 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java @@ -7,7 +7,7 @@ /** Samples for Configurations ListByServer. */ public final class ConfigurationsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ConfigurationListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationListByServer.json */ /** * Sample code: ConfigurationList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutSamples.java index f5ef7ad4803c5..6a71105205665 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutSamples.java @@ -7,7 +7,7 @@ /** Samples for Configurations Put. */ public final class ConfigurationsPutSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ConfigurationUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationUpdate.json */ /** * Sample code: Update a user configuration. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsUpdateSamples.java index 28c6e53dc3b27..5c73e5a5a8e2a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsUpdateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsUpdateSamples.java @@ -9,7 +9,7 @@ /** Samples for Configurations Update. */ public final class ConfigurationsUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ConfigurationUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationUpdate.json */ /** * Sample code: Update a user configuration. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateSamples.java index 9048179ee21f8..7bb01813db7e1 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateSamples.java @@ -7,7 +7,7 @@ /** Samples for Databases Create. */ public final class DatabasesCreateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabaseCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseCreate.json */ /** * Sample code: Create a database. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteSamples.java index ed9a9036ff899..a9f7e4fbe09ee 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Databases Delete. */ public final class DatabasesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabaseDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseDelete.json */ /** * Sample code: Delete a database. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetSamples.java index 310e8b131cfcc..7138fe44d5d97 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for Databases Get. */ public final class DatabasesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabaseGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseGet.json */ /** * Sample code: Get a database. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerSamples.java index 1c81e0946ba90..29af7845be26a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerSamples.java @@ -7,7 +7,7 @@ /** Samples for Databases ListByServer. */ public final class DatabasesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/DatabasesListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabasesListByServer.json */ /** * Sample code: List databases in a server. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java index 5a38e69b3f49e..2207119513a2c 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java @@ -7,7 +7,7 @@ /** Samples for FirewallRules CreateOrUpdate. */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/FirewallRuleCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleCreate.json */ /** * Sample code: FirewallRuleCreate. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java index 7205fa07fdd49..7cf0bf1606389 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for FirewallRules Delete. */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/FirewallRuleDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleDelete.json */ /** * Sample code: FirewallRuleDelete. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetSamples.java index cce53009c3d70..0f0a1b94624f7 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for FirewallRules Get. */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/FirewallRuleGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleGet.json */ /** * Sample code: FirewallRuleList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java index 9e596f2b11d79..78a9e4a1aedd4 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java @@ -7,7 +7,7 @@ /** Samples for FirewallRules ListByServer. */ public final class FirewallRulesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/FirewallRuleListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleListByServer.json */ /** * Sample code: FirewallRuleList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FlexibleServerStartLtrBackupSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FlexibleServerStartLtrBackupSamples.java new file mode 100644 index 0000000000000..534bc9b9c52fc --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FlexibleServerStartLtrBackupSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupSettings; +import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupStoreDetails; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrBackupRequest; +import java.util.Arrays; + +/** Samples for FlexibleServer StartLtrBackup. */ +public final class FlexibleServerStartLtrBackupSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionBackup.json + */ + /** + * Sample code: Sample_ExecuteBackup. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void sampleExecuteBackup( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .flexibleServers() + .startLtrBackup( + "rgLongTermRetention", + "pgsqlltrtestserver", + new LtrBackupRequest() + .withBackupSettings(new BackupSettings().withBackupName("backup1")) + .withTargetDetails(new BackupStoreDetails().withSasUriList(Arrays.asList("sasuri"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FlexibleServerTriggerLtrPreBackupSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FlexibleServerTriggerLtrPreBackupSamples.java new file mode 100644 index 0000000000000..c0d63807b1083 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FlexibleServerTriggerLtrPreBackupSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlflexibleserver.models.BackupSettings; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LtrPreBackupRequest; + +/** Samples for FlexibleServer TriggerLtrPreBackup. */ +public final class FlexibleServerTriggerLtrPreBackupSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionPreBackup.json + */ + /** + * Sample code: Sample_Prebackup. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void samplePrebackup(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .flexibleServers() + .triggerLtrPreBackupWithResponse( + "rgLongTermRetention", + "pgsqlltrtestserver", + new LtrPreBackupRequest().withBackupSettings(new BackupSettings().withBackupName("backup1")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java index 1fa3b6d2a937d..2b262fbab5c55 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java @@ -7,7 +7,7 @@ /** Samples for GetPrivateDnsZoneSuffix Execute. */ public final class GetPrivateDnsZoneSuffixExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/GetPrivateDnsZoneSuffix.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/GetPrivateDnsZoneSuffix.json */ /** * Sample code: GetPrivateDnsZoneSuffix. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java index 715eb7a4d78b0..dbca2f611d08f 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java @@ -7,7 +7,7 @@ /** Samples for LocationBasedCapabilities Execute. */ public final class LocationBasedCapabilitiesExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/CapabilitiesByLocation.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CapabilitiesByLocation.json */ /** * Sample code: CapabilitiesList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LogFilesListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LogFilesListByServerSamples.java new file mode 100644 index 0000000000000..abb113c0e6239 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LogFilesListByServerSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +/** Samples for LogFiles ListByServer. */ +public final class LogFilesListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LogFilesListByServer.json + */ + /** + * Sample code: List all server log files for a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listAllServerLogFilesForAServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.logFiles().listByServer("testrg", "postgresqltestsvc1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LtrBackupOperationsGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LtrBackupOperationsGetSamples.java new file mode 100644 index 0000000000000..d7017d2d4177d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LtrBackupOperationsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +/** Samples for LtrBackupOperations Get. */ +public final class LtrBackupOperationsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationGet.json + */ + /** + * Sample code: Sample. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void sample(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .ltrBackupOperations() + .getWithResponse("rgLongTermRetention", "pgsqlltrtestserver", "backup1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LtrBackupOperationsListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LtrBackupOperationsListByServerSamples.java new file mode 100644 index 0000000000000..9241d4a90dd48 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LtrBackupOperationsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +/** Samples for LtrBackupOperations ListByServer. */ +public final class LtrBackupOperationsListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationListByServer.json + */ + /** + * Sample code: Sample List of Long Tern Retention Operations by Flexible Server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void sampleListOfLongTernRetentionOperationsByFlexibleServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .ltrBackupOperations() + .listByServer("rgLongTermRetention", "pgsqlltrtestserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsCreateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsCreateSamples.java new file mode 100644 index 0000000000000..0b7f3124d6510 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsCreateSamples.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlflexibleserver.models.AdminCredentials; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationMode; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationSecretParameters; +import com.azure.resourcemanager.postgresqlflexibleserver.models.OverwriteDbsInTargetEnum; +import java.util.Arrays; + +/** Samples for Migrations Create. */ +public final class MigrationsCreateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Create_With_Other_Users.json + */ + /** + * Sample code: Migrations Create by passing user names. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsCreateByPassingUserNames( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .define("testmigration") + .withRegion("westus") + .withExistingFlexibleServer("ffffffff-ffff-ffff-ffff-ffffffffffff", "testrg", "testtarget") + .withMigrationMode(MigrationMode.OFFLINE) + .withSourceDbServerResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource") + .withSecretParameters( + new MigrationSecretParameters() + .withAdminCredentials( + new AdminCredentials() + .withSourceServerPassword("fakeTokenPlaceholder") + .withTargetServerPassword("fakeTokenPlaceholder")) + .withSourceServerUsername("newadmin@testsource") + .withTargetServerUsername("targetadmin")) + .withDbsToMigrate(Arrays.asList("db1", "db2", "db3", "db4")) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Create.json + */ + /** + * Sample code: Migrations_Create. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsCreate(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .define("testmigration") + .withRegion("westus") + .withExistingFlexibleServer("ffffffff-ffff-ffff-ffff-ffffffffffff", "testrg", "testtarget") + .withMigrationMode(MigrationMode.OFFLINE) + .withSourceDbServerResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource") + .withSecretParameters( + new MigrationSecretParameters() + .withAdminCredentials( + new AdminCredentials() + .withSourceServerPassword("fakeTokenPlaceholder") + .withTargetServerPassword("fakeTokenPlaceholder"))) + .withDbsToMigrate(Arrays.asList("db1", "db2", "db3", "db4")) + .withOverwriteDbsInTarget(OverwriteDbsInTargetEnum.TRUE) + .create(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsDeleteSamples.java new file mode 100644 index 0000000000000..049b33402670a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +/** Samples for Migrations Delete. */ +public final class MigrationsDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Delete.json + */ + /** + * Sample code: Migrations_Delete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsDelete(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .deleteWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + "testmigration", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsGetSamples.java new file mode 100644 index 0000000000000..5fbe49e5741aa --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +/** Samples for Migrations Get. */ +public final class MigrationsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Get.json + */ + /** + * Sample code: Migrations_Get. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .getWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + "testmigration", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsListByTargetServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsListByTargetServerSamples.java new file mode 100644 index 0000000000000..994104ab12fd7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsListByTargetServerSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationListFilter; + +/** Samples for Migrations ListByTargetServer. */ +public final class MigrationsListByTargetServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_ListByTargetServer.json + */ + /** + * Sample code: Migrations_ListByTargetServer. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsListByTargetServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .migrations() + .listByTargetServer( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + MigrationListFilter.ALL, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsUpdateSamples.java new file mode 100644 index 0000000000000..1c65c0f1046e8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MigrationsUpdateSamples.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlflexibleserver.models.CancelEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogicalReplicationOnSourceDbEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MigrationResource; + +/** Samples for Migrations Update. */ +public final class MigrationsUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Cancel.json + */ + /** + * Sample code: Cancel migration. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void cancelMigration(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + MigrationResource resource = + manager + .migrations() + .getWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + "testmigration", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withCancel(CancelEnum.TRUE).apply(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Update.json + */ + /** + * Sample code: Migrations_Update. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void migrationsUpdate(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + MigrationResource resource = + manager + .migrations() + .getWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + "testmigration", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withSetupLogicalReplicationOnSourceDbIfNeeded(LogicalReplicationOnSourceDbEnum.TRUE).apply(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListSamples.java index 1c45fb814677b..aa827950f8e33 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/OperationList.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/OperationList.json */ /** * Sample code: OperationList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ReplicasListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ReplicasListByServerSamples.java index e81f7761c4930..6a45366ae3ffa 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ReplicasListByServerSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ReplicasListByServerSamples.java @@ -7,7 +7,7 @@ /** Samples for Replicas ListByServer. */ public final class ReplicasListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ReplicasListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ReplicasListByServer.json */ /** * Sample code: ReplicasListByServer. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ResourceProviderCheckMigrationNameAvailabilitySamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ResourceProviderCheckMigrationNameAvailabilitySamples.java new file mode 100644 index 0000000000000..6ad924086c6b0 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ResourceProviderCheckMigrationNameAvailabilitySamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.MigrationNameAvailabilityResourceInner; + +/** Samples for ResourceProvider CheckMigrationNameAvailability. */ +public final class ResourceProviderCheckMigrationNameAvailabilitySamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckMigrationNameAvailability.json + */ + /** + * Sample code: CheckMigrationNameAvailability. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void checkMigrationNameAvailability( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .resourceProviders() + .checkMigrationNameAvailabilityWithResponse( + "ffffffff-ffff-ffff-ffff-ffffffffffff", + "testrg", + "testtarget", + new MigrationNameAvailabilityResourceInner() + .withName("name1") + .withType("Microsoft.DBforPostgreSQL/flexibleServers/migrations"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerCapabilitiesListSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerCapabilitiesListSamples.java new file mode 100644 index 0000000000000..19ccb1685c769 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerCapabilitiesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +/** Samples for ServerCapabilities List. */ +public final class ServerCapabilitiesListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCapabilities.json + */ + /** + * Sample code: ServerCapabilitiesList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverCapabilitiesList( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverCapabilities().list("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersCreateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersCreateSamples.java index 759cede2c3a55..2ef03d3e9cd89 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersCreateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersCreateSamples.java @@ -7,6 +7,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.ActiveDirectoryAuthEnum; import com.azure.resourcemanager.postgresqlflexibleserver.models.ArmServerKeyType; import com.azure.resourcemanager.postgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTiers; import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode; import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption; @@ -20,6 +21,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow; import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity; import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity; import java.time.OffsetDateTime; @@ -29,7 +31,7 @@ /** Samples for Servers Create. */ public final class ServersCreateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithDataEncryptionEnabled.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateWithDataEncryptionEnabled.json */ /** * Sample code: ServerCreateWithDataEncryptionEnabled. @@ -55,12 +57,14 @@ public static void serverCreateWithDataEncryptionEnabled( .withAdministratorLogin("cloudsa") .withAdministratorLoginPassword("password") .withVersion(ServerVersion.ONE_TWO) - .withStorage(new Storage().withStorageSizeGB(512)) + .withStorage(new Storage().withStorageSizeGB(512).withAutoGrow(StorageAutoGrow.DISABLED)) .withDataEncryption( new DataEncryption() .withPrimaryKeyUri("fakeTokenPlaceholder") .withPrimaryUserAssignedIdentityId( "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withGeoBackupKeyUri("fakeTokenPlaceholder") + .withGeoBackupUserAssignedIdentityId("") .withType(ArmServerKeyType.AZURE_KEY_VAULT)) .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED)) .withNetwork( @@ -76,7 +80,29 @@ public static void serverCreateWithDataEncryptionEnabled( } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateGeoRestore.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateReviveDropped.json + */ + /** + * Sample code: ServerCreateReviveDropped. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverCreateReviveDropped( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .servers() + .define("pgtestsvc5-rev") + .withRegion("westus") + .withExistingResourceGroup("testrg") + .withSourceServerResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5") + .withPointInTimeUtc(OffsetDateTime.parse("2023-04-27T00:04:59.4078005+00:00")) + .withCreateMode(CreateMode.REVIVE_DROPPED) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateGeoRestoreWithDataEncryptionEnabled.json */ /** * Sample code: Create a database as a geo-restore in geo-paired location. @@ -90,6 +116,24 @@ public static void createADatabaseAsAGeoRestoreInGeoPairedLocation( .define("pgtestsvc5geo") .withRegion("eastus") .withExistingResourceGroup("testrg") + .withIdentity( + new UserAssignedIdentity() + .withUserAssignedIdentities( + mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity", + new UserIdentity(), + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + new UserIdentity())) + .withType(IdentityType.USER_ASSIGNED)) + .withDataEncryption( + new DataEncryption() + .withPrimaryKeyUri("fakeTokenPlaceholder") + .withPrimaryUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withGeoBackupKeyUri("fakeTokenPlaceholder") + .withGeoBackupUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity") + .withType(ArmServerKeyType.AZURE_KEY_VAULT)) .withSourceServerResourceId( "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername") .withPointInTimeUtc(OffsetDateTime.parse("2021-06-27T00:04:59.4078005+00:00")) @@ -98,7 +142,7 @@ public static void createADatabaseAsAGeoRestoreInGeoPairedLocation( } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreate.json */ /** * Sample code: Create a new server. @@ -116,7 +160,11 @@ public static void createANewServer(com.azure.resourcemanager.postgresqlflexible .withAdministratorLogin("cloudsa") .withAdministratorLoginPassword("password") .withVersion(ServerVersion.ONE_TWO) - .withStorage(new Storage().withStorageSizeGB(512)) + .withStorage( + new Storage() + .withStorageSizeGB(512) + .withAutoGrow(StorageAutoGrow.DISABLED) + .withIopsTier(AzureManagedDiskPerformanceTiers.P20)) .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED)) .withNetwork( new Network() @@ -131,7 +179,7 @@ public static void createANewServer(com.azure.resourcemanager.postgresqlflexible } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateWithAadAuthEnabled.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateWithAadAuthEnabled.json */ /** * Sample code: Create a new server with active directory authentication enabled. @@ -150,7 +198,11 @@ public static void createANewServerWithActiveDirectoryAuthenticationEnabled( .withAdministratorLogin("cloudsa") .withAdministratorLoginPassword("password") .withVersion(ServerVersion.ONE_TWO) - .withStorage(new Storage().withStorageSizeGB(512)) + .withStorage( + new Storage() + .withStorageSizeGB(512) + .withAutoGrow(StorageAutoGrow.DISABLED) + .withIopsTier(AzureManagedDiskPerformanceTiers.P20)) .withAuthConfig( new AuthConfig() .withActiveDirectoryAuth(ActiveDirectoryAuthEnum.ENABLED) @@ -171,7 +223,7 @@ public static void createANewServerWithActiveDirectoryAuthenticationEnabled( } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreateReplica.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateReplica.json */ /** * Sample code: ServerCreateReplica. @@ -185,6 +237,21 @@ public static void serverCreateReplica( .define("pgtestsvc5rep") .withRegion("westus") .withExistingResourceGroup("testrg") + .withIdentity( + new UserAssignedIdentity() + .withUserAssignedIdentities( + mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + new UserIdentity())) + .withType(IdentityType.USER_ASSIGNED)) + .withDataEncryption( + new DataEncryption() + .withPrimaryKeyUri("fakeTokenPlaceholder") + .withPrimaryUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withGeoBackupKeyUri("fakeTokenPlaceholder") + .withGeoBackupUserAssignedIdentityId("") + .withType(ArmServerKeyType.AZURE_KEY_VAULT)) .withSourceServerResourceId( "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername") .withPointInTimeUtc(OffsetDateTime.parse("2021-06-27T00:04:59.4078005+00:00")) @@ -193,7 +260,7 @@ public static void serverCreateReplica( } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerCreatePointInTimeRestore.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreatePointInTimeRestore.json */ /** * Sample code: Create a database as a point in time restore. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteSamples.java index 506b982f2125d..ad50a369dac07 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Servers Delete. */ public final class ServersDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerDelete.json */ /** * Sample code: ServerDelete. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java index f275aaaf5bb28..524b179fbffc8 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Servers GetByResourceGroup. */ public final class ServersGetByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGet.json */ /** * Sample code: ServerGet. @@ -19,7 +19,7 @@ public static void serverGet(com.azure.resourcemanager.postgresqlflexibleserver. } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerGetWithVnet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGetWithVnet.json */ /** * Sample code: ServerGetWithVnet. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java index f726b9ffd8459..ad93c14b9522a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Servers ListByResourceGroup. */ public final class ServersListByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerListByResourceGroup.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerListByResourceGroup.json */ /** * Sample code: ServerListByResourceGroup. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListSamples.java index 61b05ecd6e2ad..f3a98280c6b5d 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListSamples.java @@ -7,7 +7,7 @@ /** Samples for Servers List. */ public final class ServersListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerList.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerList.json */ /** * Sample code: ServerList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartSamples.java index 5d59750732a94..5ec2f5ed6231b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartSamples.java @@ -10,7 +10,7 @@ /** Samples for Servers Restart. */ public final class ServersRestartSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerRestart.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerRestart.json */ /** * Sample code: ServerRestart. @@ -22,7 +22,7 @@ public static void serverRestart(com.azure.resourcemanager.postgresqlflexibleser } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerRestartWithFailover.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerRestartWithFailover.json */ /** * Sample code: ServerRestartWithFailover. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartSamples.java index 8898c999baeb5..8352cb17d3062 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartSamples.java @@ -7,7 +7,7 @@ /** Samples for Servers Start. */ public final class ServersStartSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerStart.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerStart.json */ /** * Sample code: ServerStart. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopSamples.java index 434fb17f8be23..7f1321feb857f 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopSamples.java @@ -7,7 +7,7 @@ /** Samples for Servers Stop. */ public final class ServersStopSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerStop.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerStop.json */ /** * Sample code: ServerStop. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersUpdateSamples.java index 8b0088bc998d4..50fc14db7c4e4 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersUpdateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersUpdateSamples.java @@ -7,6 +7,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.ActiveDirectoryAuthEnum; import com.azure.resourcemanager.postgresqlflexibleserver.models.ArmServerKeyType; import com.azure.resourcemanager.postgresqlflexibleserver.models.AuthConfig; +import com.azure.resourcemanager.postgresqlflexibleserver.models.AzureManagedDiskPerformanceTiers; import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForUpdate; import com.azure.resourcemanager.postgresqlflexibleserver.models.DataEncryption; @@ -18,6 +19,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageAutoGrow; import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity; import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity; import java.util.HashMap; @@ -26,7 +28,7 @@ /** Samples for Servers Update. */ public final class ServersUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdateWithAadAuthEnabled.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithAadAuthEnabled.json */ /** * Sample code: ServerUpdateWithAadAuthEnabled. @@ -44,7 +46,11 @@ public static void serverUpdateWithAadAuthEnabled( .update() .withSku(new Sku().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE)) .withAdministratorLoginPassword("newpassword") - .withStorage(new Storage().withStorageSizeGB(1024)) + .withStorage( + new Storage() + .withStorageSizeGB(1024) + .withAutoGrow(StorageAutoGrow.DISABLED) + .withIopsTier(AzureManagedDiskPerformanceTiers.P30)) .withBackup(new Backup().withBackupRetentionDays(20)) .withAuthConfig( new AuthConfig() @@ -56,7 +62,7 @@ public static void serverUpdateWithAadAuthEnabled( } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdateWithDataEncryptionEnabled.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithDataEncryptionEnabled.json */ /** * Sample code: ServerUpdateWithDataEncryptionEnabled. @@ -77,24 +83,28 @@ public static void serverUpdateWithDataEncryptionEnabled( new UserAssignedIdentity() .withUserAssignedIdentities( mapOf( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity", + new UserIdentity(), "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", new UserIdentity())) .withType(IdentityType.USER_ASSIGNED)) .withAdministratorLoginPassword("newpassword") - .withStorage(new Storage().withStorageSizeGB(1024)) .withBackup(new Backup().withBackupRetentionDays(20)) .withDataEncryption( new DataEncryption() .withPrimaryKeyUri("fakeTokenPlaceholder") .withPrimaryUserAssignedIdentityId( "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity") + .withGeoBackupKeyUri("fakeTokenPlaceholder") + .withGeoBackupUserAssignedIdentityId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity") .withType(ArmServerKeyType.AZURE_KEY_VAULT)) .withCreateMode(CreateModeForUpdate.UPDATE) .apply(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdate.json */ /** * Sample code: ServerUpdate. @@ -111,14 +121,18 @@ public static void serverUpdate(com.azure.resourcemanager.postgresqlflexibleserv .update() .withSku(new Sku().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE)) .withAdministratorLoginPassword("newpassword") - .withStorage(new Storage().withStorageSizeGB(1024)) + .withStorage( + new Storage() + .withStorageSizeGB(1024) + .withAutoGrow(StorageAutoGrow.ENABLED) + .withIopsTier(AzureManagedDiskPerformanceTiers.P30)) .withBackup(new Backup().withBackupRetentionDays(20)) .withCreateMode(CreateModeForUpdate.UPDATE) .apply(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdateWithMajorVersionUpgrade.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithMajorVersionUpgrade.json */ /** * Sample code: ServerUpdateWithMajorVersionUpgrade. @@ -136,7 +150,7 @@ public static void serverUpdateWithMajorVersionUpgrade( } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/ServerUpdateWithCustomerMaintenanceWindow.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json */ /** * Sample code: ServerUpdateWithCustomerMaintenanceWindow. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.java index b8ba5c147b2e0..7c0953f22c3db 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.java @@ -9,7 +9,7 @@ /** Samples for VirtualNetworkSubnetUsage Execute. */ public final class VirtualNetworkSubnetUsageExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-12-01/examples/VirtualNetworkSubnetUsage.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/VirtualNetworkSubnetUsage.json */ /** * Sample code: VirtualNetworkSubnetUsageList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ActiveDirectoryAdministratorAddTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ActiveDirectoryAdministratorAddTests.java deleted file mode 100644 index f28b1696a5520..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ActiveDirectoryAdministratorAddTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ActiveDirectoryAdministratorAdd; -import com.azure.resourcemanager.postgresqlflexibleserver.models.PrincipalType; -import org.junit.jupiter.api.Assertions; - -public final class ActiveDirectoryAdministratorAddTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ActiveDirectoryAdministratorAdd model = - BinaryData - .fromString( - "{\"properties\":{\"principalType\":\"Unknown\",\"principalName\":\"uv\",\"tenantId\":\"xpyb\"}}") - .toObject(ActiveDirectoryAdministratorAdd.class); - Assertions.assertEquals(PrincipalType.UNKNOWN, model.principalType()); - Assertions.assertEquals("uv", model.principalName()); - Assertions.assertEquals("xpyb", model.tenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ActiveDirectoryAdministratorAdd model = - new ActiveDirectoryAdministratorAdd() - .withPrincipalType(PrincipalType.UNKNOWN) - .withPrincipalName("uv") - .withTenantId("xpyb"); - model = BinaryData.fromObject(model).toObject(ActiveDirectoryAdministratorAdd.class); - Assertions.assertEquals(PrincipalType.UNKNOWN, model.principalType()); - Assertions.assertEquals("uv", model.principalName()); - Assertions.assertEquals("xpyb", model.tenantId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ActiveDirectoryAdministratorInnerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ActiveDirectoryAdministratorInnerTests.java deleted file mode 100644 index f3d63398be3f8..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ActiveDirectoryAdministratorInnerTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ActiveDirectoryAdministratorInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.PrincipalType; -import org.junit.jupiter.api.Assertions; - -public final class ActiveDirectoryAdministratorInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ActiveDirectoryAdministratorInner model = - BinaryData - .fromString( - "{\"properties\":{\"principalType\":\"Unknown\",\"principalName\":\"msxaobhd\",\"objectId\":\"mtqio\",\"tenantId\":\"zehtbmu\"},\"id\":\"ownoizhw\",\"name\":\"rxybqsoq\",\"type\":\"jgkdmbpazlobcu\"}") - .toObject(ActiveDirectoryAdministratorInner.class); - Assertions.assertEquals(PrincipalType.UNKNOWN, model.principalType()); - Assertions.assertEquals("msxaobhd", model.principalName()); - Assertions.assertEquals("mtqio", model.objectId()); - Assertions.assertEquals("zehtbmu", model.tenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ActiveDirectoryAdministratorInner model = - new ActiveDirectoryAdministratorInner() - .withPrincipalType(PrincipalType.UNKNOWN) - .withPrincipalName("msxaobhd") - .withObjectId("mtqio") - .withTenantId("zehtbmu"); - model = BinaryData.fromObject(model).toObject(ActiveDirectoryAdministratorInner.class); - Assertions.assertEquals(PrincipalType.UNKNOWN, model.principalType()); - Assertions.assertEquals("msxaobhd", model.principalName()); - Assertions.assertEquals("mtqio", model.objectId()); - Assertions.assertEquals("zehtbmu", model.tenantId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorListResultTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorListResultTests.java deleted file mode 100644 index 4f244da44c62c..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorListResultTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ActiveDirectoryAdministratorInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.AdministratorListResult; -import com.azure.resourcemanager.postgresqlflexibleserver.models.PrincipalType; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AdministratorListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AdministratorListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"principalType\":\"User\",\"principalName\":\"xrifkwmrvkts\",\"objectId\":\"nt\",\"tenantId\":\"ipa\"},\"id\":\"ajpsquc\",\"name\":\"poyfdkfogkn\",\"type\":\"gjofjd\"},{\"properties\":{\"principalType\":\"Unknown\",\"principalName\":\"rd\",\"objectId\":\"pewnw\",\"tenantId\":\"itjz\"},\"id\":\"lusarh\",\"name\":\"ofcqhsm\",\"type\":\"urkdtmlx\"},{\"properties\":{\"principalType\":\"Group\",\"principalName\":\"k\",\"objectId\":\"txukcdmp\",\"tenantId\":\"cryuan\"},\"id\":\"uxzdxtay\",\"name\":\"lhmwhfpmrqobm\",\"type\":\"u\"},{\"properties\":{\"principalType\":\"User\",\"principalName\":\"yrtih\",\"objectId\":\"tijbpzvgnwzsymgl\",\"tenantId\":\"fcyzkohdbihanufh\"},\"id\":\"bj\",\"name\":\"s\",\"type\":\"git\"}],\"nextLink\":\"qhabifpikxwcz\"}") - .toObject(AdministratorListResult.class); - Assertions.assertEquals(PrincipalType.USER, model.value().get(0).principalType()); - Assertions.assertEquals("xrifkwmrvkts", model.value().get(0).principalName()); - Assertions.assertEquals("nt", model.value().get(0).objectId()); - Assertions.assertEquals("ipa", model.value().get(0).tenantId()); - Assertions.assertEquals("qhabifpikxwcz", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AdministratorListResult model = - new AdministratorListResult() - .withValue( - Arrays - .asList( - new ActiveDirectoryAdministratorInner() - .withPrincipalType(PrincipalType.USER) - .withPrincipalName("xrifkwmrvkts") - .withObjectId("nt") - .withTenantId("ipa"), - new ActiveDirectoryAdministratorInner() - .withPrincipalType(PrincipalType.UNKNOWN) - .withPrincipalName("rd") - .withObjectId("pewnw") - .withTenantId("itjz"), - new ActiveDirectoryAdministratorInner() - .withPrincipalType(PrincipalType.GROUP) - .withPrincipalName("k") - .withObjectId("txukcdmp") - .withTenantId("cryuan"), - new ActiveDirectoryAdministratorInner() - .withPrincipalType(PrincipalType.USER) - .withPrincipalName("yrtih") - .withObjectId("tijbpzvgnwzsymgl") - .withTenantId("fcyzkohdbihanufh"))) - .withNextLink("qhabifpikxwcz"); - model = BinaryData.fromObject(model).toObject(AdministratorListResult.class); - Assertions.assertEquals(PrincipalType.USER, model.value().get(0).principalType()); - Assertions.assertEquals("xrifkwmrvkts", model.value().get(0).principalName()); - Assertions.assertEquals("nt", model.value().get(0).objectId()); - Assertions.assertEquals("ipa", model.value().get(0).tenantId()); - Assertions.assertEquals("qhabifpikxwcz", model.nextLink()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorPropertiesForAddTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorPropertiesForAddTests.java deleted file mode 100644 index 72b2a7ea4da9a..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorPropertiesForAddTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.AdministratorPropertiesForAdd; -import com.azure.resourcemanager.postgresqlflexibleserver.models.PrincipalType; -import org.junit.jupiter.api.Assertions; - -public final class AdministratorPropertiesForAddTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AdministratorPropertiesForAdd model = - BinaryData - .fromString( - "{\"principalType\":\"Unknown\",\"principalName\":\"hmtzopbsphrup\",\"tenantId\":\"gsybbejhp\"}") - .toObject(AdministratorPropertiesForAdd.class); - Assertions.assertEquals(PrincipalType.UNKNOWN, model.principalType()); - Assertions.assertEquals("hmtzopbsphrup", model.principalName()); - Assertions.assertEquals("gsybbejhp", model.tenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AdministratorPropertiesForAdd model = - new AdministratorPropertiesForAdd() - .withPrincipalType(PrincipalType.UNKNOWN) - .withPrincipalName("hmtzopbsphrup") - .withTenantId("gsybbejhp"); - model = BinaryData.fromObject(model).toObject(AdministratorPropertiesForAdd.class); - Assertions.assertEquals(PrincipalType.UNKNOWN, model.principalType()); - Assertions.assertEquals("hmtzopbsphrup", model.principalName()); - Assertions.assertEquals("gsybbejhp", model.tenantId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorPropertiesTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorPropertiesTests.java deleted file mode 100644 index 06f0731f9a684..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorPropertiesTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.AdministratorProperties; -import com.azure.resourcemanager.postgresqlflexibleserver.models.PrincipalType; -import org.junit.jupiter.api.Assertions; - -public final class AdministratorPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AdministratorProperties model = - BinaryData - .fromString( - "{\"principalType\":\"Group\",\"principalName\":\"nrbtcqqjnq\",\"objectId\":\"hqgnufooojywif\",\"tenantId\":\"esaagdfm\"}") - .toObject(AdministratorProperties.class); - Assertions.assertEquals(PrincipalType.GROUP, model.principalType()); - Assertions.assertEquals("nrbtcqqjnq", model.principalName()); - Assertions.assertEquals("hqgnufooojywif", model.objectId()); - Assertions.assertEquals("esaagdfm", model.tenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AdministratorProperties model = - new AdministratorProperties() - .withPrincipalType(PrincipalType.GROUP) - .withPrincipalName("nrbtcqqjnq") - .withObjectId("hqgnufooojywif") - .withTenantId("esaagdfm"); - model = BinaryData.fromObject(model).toObject(AdministratorProperties.class); - Assertions.assertEquals(PrincipalType.GROUP, model.principalType()); - Assertions.assertEquals("nrbtcqqjnq", model.principalName()); - Assertions.assertEquals("hqgnufooojywif", model.objectId()); - Assertions.assertEquals("esaagdfm", model.tenantId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsCreateMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsCreateMockTests.java deleted file mode 100644 index e57c72a6c3978..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsCreateMockTests.java +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ActiveDirectoryAdministrator; -import com.azure.resourcemanager.postgresqlflexibleserver.models.PrincipalType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class AdministratorsCreateMockTests { - @Test - public void testCreate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"principalType\":\"Group\",\"principalName\":\"pe\",\"objectId\":\"wfbkrvrns\",\"tenantId\":\"hqjohxcrsbfova\"},\"id\":\"ruvw\",\"name\":\"hsqfsubcgjbirxbp\",\"type\":\"bsrfbj\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ActiveDirectoryAdministrator response = - manager - .administrators() - .define("qtdo") - .withExistingFlexibleServer("vjfdx", "ivetvtcq") - .withPrincipalType(PrincipalType.USER) - .withPrincipalName("vwvxyslqbhsfx") - .withTenantId("lyt") - .create(); - - Assertions.assertEquals(PrincipalType.GROUP, response.principalType()); - Assertions.assertEquals("pe", response.principalName()); - Assertions.assertEquals("wfbkrvrns", response.objectId()); - Assertions.assertEquals("hqjohxcrsbfova", response.tenantId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsDeleteMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsDeleteMockTests.java deleted file mode 100644 index c98bc3d4bbec3..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class AdministratorsDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.administrators().delete("xisxyawjoyaqcsl", "jpkiidzyexznelix", "nr", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsGetWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsGetWithResponseMockTests.java deleted file mode 100644 index 6fdd1a87f9ba8..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsGetWithResponseMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ActiveDirectoryAdministrator; -import com.azure.resourcemanager.postgresqlflexibleserver.models.PrincipalType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class AdministratorsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"principalType\":\"ServicePrincipal\",\"principalName\":\"gylgqgitxmedjvcs\",\"objectId\":\"n\",\"tenantId\":\"wncwzzhxgktrmg\"},\"id\":\"napkteoellw\",\"name\":\"tfdygpfqb\",\"type\":\"ac\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ActiveDirectoryAdministrator response = - manager - .administrators() - .getWithResponse("tfolhbnx", "nalaulppg", "dtpnapnyiropuhp", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, response.principalType()); - Assertions.assertEquals("gylgqgitxmedjvcs", response.principalName()); - Assertions.assertEquals("n", response.objectId()); - Assertions.assertEquals("wncwzzhxgktrmg", response.tenantId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsListByServerMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsListByServerMockTests.java deleted file mode 100644 index 169404de90aee..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/AdministratorsListByServerMockTests.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ActiveDirectoryAdministrator; -import com.azure.resourcemanager.postgresqlflexibleserver.models.PrincipalType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class AdministratorsListByServerMockTests { - @Test - public void testListByServer() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"principalType\":\"Group\",\"principalName\":\"ol\",\"objectId\":\"ahzxctobgbk\",\"tenantId\":\"oizpostmgrcfbun\"},\"id\":\"fqjhhkxbpvjymj\",\"name\":\"xxjyngudivkrtsw\",\"type\":\"xqzvszjfa\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.administrators().listByServer("op", "fqrhhuaopppc", com.azure.core.util.Context.NONE); - - Assertions.assertEquals(PrincipalType.GROUP, response.iterator().next().principalType()); - Assertions.assertEquals("ol", response.iterator().next().principalName()); - Assertions.assertEquals("ahzxctobgbk", response.iterator().next().objectId()); - Assertions.assertEquals("oizpostmgrcfbun", response.iterator().next().tenantId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupTests.java deleted file mode 100644 index 696a427c228da..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.GeoRedundantBackupEnum; -import org.junit.jupiter.api.Assertions; - -public final class BackupTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Backup model = - BinaryData - .fromString( - "{\"backupRetentionDays\":136140206,\"geoRedundantBackup\":\"Disabled\",\"earliestRestoreDate\":\"2021-10-14T11:42:47Z\"}") - .toObject(Backup.class); - Assertions.assertEquals(136140206, model.backupRetentionDays()); - Assertions.assertEquals(GeoRedundantBackupEnum.DISABLED, model.geoRedundantBackup()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Backup model = - new Backup().withBackupRetentionDays(136140206).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED); - model = BinaryData.fromObject(model).toObject(Backup.class); - Assertions.assertEquals(136140206, model.backupRetentionDays()); - Assertions.assertEquals(GeoRedundantBackupEnum.DISABLED, model.geoRedundantBackup()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsGetWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsGetWithResponseMockTests.java deleted file mode 100644 index e3fcdc7f52471..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsGetWithResponseMockTests.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Origin; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerBackup; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class BackupsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"backupType\":\"Full\",\"completedTime\":\"2021-01-01T17:03:19Z\",\"source\":\"ujmkcjhwqy\"},\"id\":\"r\",\"name\":\"bnw\",\"type\":\"ewgdrjervn\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ServerBackup response = - manager - .backups() - .getWithResponse("dtws", "otftpvjzbexilz", "nfqqnvwp", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(Origin.FULL, response.backupType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-01T17:03:19Z"), response.completedTime()); - Assertions.assertEquals("ujmkcjhwqy", response.source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsListByServerMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsListByServerMockTests.java deleted file mode 100644 index 0ee1ad639eebe..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/BackupsListByServerMockTests.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Origin; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerBackup; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class BackupsListByServerMockTests { - @Test - public void testListByServer() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"backupType\":\"Full\",\"completedTime\":\"2021-10-24T16:26:16Z\",\"source\":\"ifthnz\"},\"id\":\"dslgnayqigynduh\",\"name\":\"vhqlkthumaqo\",\"type\":\"bgycduiertgccym\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.backups().listByServer("enq", "eh", com.azure.core.util.Context.NONE); - - Assertions.assertEquals(Origin.FULL, response.iterator().next().backupType()); - Assertions - .assertEquals(OffsetDateTime.parse("2021-10-24T16:26:16Z"), response.iterator().next().completedTime()); - Assertions.assertEquals("ifthnz", response.iterator().next().source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CapabilitiesListResultTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CapabilitiesListResultTests.java deleted file mode 100644 index f0cb9cd0ee5c2..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CapabilitiesListResultTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilitiesListResult; - -public final class CapabilitiesListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilitiesListResult model = - BinaryData - .fromString( - "{\"value\":[{\"zone\":\"wyahuxinpmqnja\",\"supportedHAMode\":[\"xj\",\"prozvcputegjvwmf\",\"atscmd\",\"pjhulsuuvmkj\"],\"geoBackupSupported\":false,\"zoneRedundantHaSupported\":true,\"zoneRedundantHaAndGeoBackupSupported\":true,\"supportedFlexibleServerEditions\":[],\"supportedHyperscaleNodeEditions\":[],\"fastProvisioningSupported\":true,\"supportedFastProvisioningEditions\":[],\"status\":\"ej\"}],\"nextLink\":\"vwryoqpso\"}") - .toObject(CapabilitiesListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilitiesListResult model = new CapabilitiesListResult(); - model = BinaryData.fromObject(model).toObject(CapabilitiesListResult.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CapabilityPropertiesInnerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CapabilityPropertiesInnerTests.java deleted file mode 100644 index 5080b63eb2803..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CapabilityPropertiesInnerTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; - -public final class CapabilityPropertiesInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityPropertiesInner model = - BinaryData - .fromString( - "{\"zone\":\"ctazakljlahbcryf\",\"supportedHAMode\":[\"dosyg\",\"xpaojakhmsbz\"],\"geoBackupSupported\":true,\"zoneRedundantHaSupported\":false,\"zoneRedundantHaAndGeoBackupSupported\":true,\"supportedFlexibleServerEditions\":[{\"name\":\"lxaolthqtrgqjbp\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"status\":\"zgvfcjrwz\"},{\"name\":\"xjtfelluwfzit\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"status\":\"pjkjlxofpdv\"}],\"supportedHyperscaleNodeEditions\":[{\"name\":\"xypininmayhuybbk\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"supportedNodeTypes\":[],\"status\":\"inuvamiheogn\"},{\"name\":\"xzxtheo\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"supportedNodeTypes\":[],\"status\":\"cciqihnhungbwjz\"},{\"name\":\"fygxgispemvtzfk\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"supportedNodeTypes\":[],\"status\":\"xqeofjaeqjhqjba\"},{\"name\":\"msmjqulngsntn\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"supportedNodeTypes\":[],\"status\":\"rwclxxwrljdo\"}],\"fastProvisioningSupported\":true,\"supportedFastProvisioningEditions\":[{\"supportedSku\":\"kocrcjdkwtnhx\",\"supportedStorageGb\":5581291117453536479,\"supportedServerVersions\":\"ksqrglssai\"},{\"supportedSku\":\"p\",\"supportedStorageGb\":2424305941403625714,\"supportedServerVersions\":\"ljfmppee\"}],\"status\":\"mgxsab\"}") - .toObject(CapabilityPropertiesInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityPropertiesInner model = new CapabilityPropertiesInner(); - model = BinaryData.fromObject(model).toObject(CapabilityPropertiesInner.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilitiesExecuteWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilitiesExecuteWithResponseMockTests.java deleted file mode 100644 index b7c2e0f483593..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilitiesExecuteWithResponseMockTests.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilityReason; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilityRequest; -import com.azure.resourcemanager.postgresqlflexibleserver.models.NameAvailability; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CheckNameAvailabilitiesExecuteWithResponseMockTests { - @Test - public void testExecuteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"name\":\"c\",\"type\":\"fwdsj\",\"nameAvailable\":true,\"reason\":\"AlreadyExists\",\"message\":\"tiiswacffg\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - NameAvailability response = - manager - .checkNameAvailabilities() - .executeWithResponse( - new CheckNameAvailabilityRequest().withName("uuvxz").withType("lvithhqzonosgg"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(true, response.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, response.reason()); - Assertions.assertEquals("tiiswacffg", response.message()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityRequestTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityRequestTests.java deleted file mode 100644 index 09e0e2f5b3872..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityRequestTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilityRequest; -import org.junit.jupiter.api.Assertions; - -public final class CheckNameAvailabilityRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckNameAvailabilityRequest model = - BinaryData - .fromString("{\"name\":\"fgugnxkrxdqmid\",\"type\":\"hzrvqd\"}") - .toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("fgugnxkrxdqmid", model.name()); - Assertions.assertEquals("hzrvqd", model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckNameAvailabilityRequest model = - new CheckNameAvailabilityRequest().withName("fgugnxkrxdqmid").withType("hzrvqd"); - model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); - Assertions.assertEquals("fgugnxkrxdqmid", model.name()); - Assertions.assertEquals("hzrvqd", model.type()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityResponseTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityResponseTests.java deleted file mode 100644 index 3eea340ccd50d..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityResponseTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilityReason; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilityResponse; -import org.junit.jupiter.api.Assertions; - -public final class CheckNameAvailabilityResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckNameAvailabilityResponse model = - BinaryData - .fromString("{\"nameAvailable\":true,\"reason\":\"AlreadyExists\",\"message\":\"rvynhzgpph\"}") - .toObject(CheckNameAvailabilityResponse.class); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, model.reason()); - Assertions.assertEquals("rvynhzgpph", model.message()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckNameAvailabilityResponse model = - new CheckNameAvailabilityResponse() - .withNameAvailable(true) - .withReason(CheckNameAvailabilityReason.ALREADY_EXISTS) - .withMessage("rvynhzgpph"); - model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityResponse.class); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, model.reason()); - Assertions.assertEquals("rvynhzgpph", model.message()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationsExecuteWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationsExecuteWithResponseMockTests.java deleted file mode 100644 index 756a81511d3b6..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityWithLocationsExecuteWithResponseMockTests.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilityReason; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilityRequest; -import com.azure.resourcemanager.postgresqlflexibleserver.models.NameAvailability; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CheckNameAvailabilityWithLocationsExecuteWithResponseMockTests { - @Test - public void testExecuteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"name\":\"wdmhdlxyjrxs\",\"type\":\"afcnih\",\"nameAvailable\":true,\"reason\":\"Invalid\",\"message\":\"edgfbcvkcvq\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - NameAvailability response = - manager - .checkNameAvailabilityWithLocations() - .executeWithResponse( - "k", - new CheckNameAvailabilityRequest().withName("ewkfvhqcrai").withType("pnppfuf"), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(true, response.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, response.reason()); - Assertions.assertEquals("edgfbcvkcvq", response.message()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationForUpdateTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationForUpdateTests.java deleted file mode 100644 index 30e48be0d36c7..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationForUpdateTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationForUpdate; -import org.junit.jupiter.api.Assertions; - -public final class ConfigurationForUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConfigurationForUpdate model = - BinaryData - .fromString( - "{\"properties\":{\"value\":\"onpc\",\"description\":\"ocohslkevleg\",\"defaultValue\":\"fbuhfmvfaxkffe\",\"dataType\":\"Boolean\",\"allowedValues\":\"lvmezyvshxmzsbbz\",\"source\":\"gigr\",\"isDynamicConfig\":true,\"isReadOnly\":false,\"isConfigPendingRestart\":false,\"unit\":\"xjnspy\",\"documentationLink\":\"tko\"}}") - .toObject(ConfigurationForUpdate.class); - Assertions.assertEquals("onpc", model.value()); - Assertions.assertEquals("gigr", model.source()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConfigurationForUpdate model = new ConfigurationForUpdate().withValue("onpc").withSource("gigr"); - model = BinaryData.fromObject(model).toObject(ConfigurationForUpdate.class); - Assertions.assertEquals("onpc", model.value()); - Assertions.assertEquals("gigr", model.source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationInnerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationInnerTests.java deleted file mode 100644 index 781abe63ed175..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationInnerTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; -import org.junit.jupiter.api.Assertions; - -public final class ConfigurationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConfigurationInner model = - BinaryData - .fromString( - "{\"properties\":{\"value\":\"xbezyiuokktwh\",\"description\":\"xw\",\"defaultValue\":\"wqsmbsur\",\"dataType\":\"Enumeration\",\"allowedValues\":\"o\",\"source\":\"ocfs\",\"isDynamicConfig\":false,\"isReadOnly\":true,\"isConfigPendingRestart\":true,\"unit\":\"stkiiuxhqyud\",\"documentationLink\":\"rrqnbpoczvyifqrv\"},\"id\":\"vjsllrmvvdfw\",\"name\":\"t\",\"type\":\"pnpulexxbczwtru\"}") - .toObject(ConfigurationInner.class); - Assertions.assertEquals("xbezyiuokktwh", model.value()); - Assertions.assertEquals("ocfs", model.source()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConfigurationInner model = new ConfigurationInner().withValue("xbezyiuokktwh").withSource("ocfs"); - model = BinaryData.fromObject(model).toObject(ConfigurationInner.class); - Assertions.assertEquals("xbezyiuokktwh", model.value()); - Assertions.assertEquals("ocfs", model.source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationListResultTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationListResultTests.java deleted file mode 100644 index 43b8afe5fe0e0..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationListResultTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ConfigurationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConfigurationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"value\":\"cocpecfvmmcoofsx\",\"description\":\"evgbmqjq\",\"defaultValue\":\"c\",\"dataType\":\"Integer\",\"allowedValues\":\"vkwlzuvccfwnf\",\"source\":\"acfi\",\"isDynamicConfig\":false,\"isReadOnly\":true,\"isConfigPendingRestart\":true,\"unit\":\"qgtz\",\"documentationLink\":\"pnqbqqwxrjfe\"},\"id\":\"lnwsubisn\",\"name\":\"ampmngnz\",\"type\":\"c\"},{\"properties\":{\"value\":\"wooc\",\"description\":\"bonqvpkvlrxnjeas\",\"defaultValue\":\"pheoflokeyy\",\"dataType\":\"Boolean\",\"allowedValues\":\"bdlwtgrhpdjpj\",\"source\":\"asxazjpqyegualhb\",\"isDynamicConfig\":false,\"isReadOnly\":false,\"isConfigPendingRestart\":true,\"unit\":\"v\",\"documentationLink\":\"dgwdslfhot\"},\"id\":\"cynpwlbjnp\",\"name\":\"acfta\",\"type\":\"ehxnltyfsop\"},{\"properties\":{\"value\":\"uesnzwdejbavo\",\"description\":\"zdmohctbqvu\",\"defaultValue\":\"xdn\",\"dataType\":\"Boolean\",\"allowedValues\":\"w\",\"source\":\"jjugwdkcglhslaz\",\"isDynamicConfig\":true,\"isReadOnly\":true,\"isConfigPendingRestart\":true,\"unit\":\"ixhbkuofqweykhm\",\"documentationLink\":\"evfyexfwhybcib\"},\"id\":\"vdcsitynn\",\"name\":\"amdecte\",\"type\":\"f\"},{\"properties\":{\"value\":\"cj\",\"description\":\"pvhez\",\"defaultValue\":\"gqhcjrefovg\",\"dataType\":\"Boolean\",\"allowedValues\":\"leyyvx\",\"source\":\"jpkcattpng\",\"isDynamicConfig\":true,\"isReadOnly\":true,\"isConfigPendingRestart\":true,\"unit\":\"pjhvmdajvnys\",\"documentationLink\":\"nqecanoaeup\"},\"id\":\"yhltrpmopjmcm\",\"name\":\"tuo\",\"type\":\"thfuiuaodsfcpkvx\"}],\"nextLink\":\"puozmyzydag\"}") - .toObject(ConfigurationListResult.class); - Assertions.assertEquals("cocpecfvmmcoofsx", model.value().get(0).value()); - Assertions.assertEquals("acfi", model.value().get(0).source()); - Assertions.assertEquals("puozmyzydag", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConfigurationListResult model = - new ConfigurationListResult() - .withValue( - Arrays - .asList( - new ConfigurationInner().withValue("cocpecfvmmcoofsx").withSource("acfi"), - new ConfigurationInner().withValue("wooc").withSource("asxazjpqyegualhb"), - new ConfigurationInner().withValue("uesnzwdejbavo").withSource("jjugwdkcglhslaz"), - new ConfigurationInner().withValue("cj").withSource("jpkcattpng"))) - .withNextLink("puozmyzydag"); - model = BinaryData.fromObject(model).toObject(ConfigurationListResult.class); - Assertions.assertEquals("cocpecfvmmcoofsx", model.value().get(0).value()); - Assertions.assertEquals("acfi", model.value().get(0).source()); - Assertions.assertEquals("puozmyzydag", model.nextLink()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationPropertiesTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationPropertiesTests.java deleted file mode 100644 index 50fb932766dfd..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationPropertiesTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationProperties; -import org.junit.jupiter.api.Assertions; - -public final class ConfigurationPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConfigurationProperties model = - BinaryData - .fromString( - "{\"value\":\"qzbqjvsov\",\"description\":\"okacspk\",\"defaultValue\":\"hzdobpxjmflbvvnc\",\"dataType\":\"Enumeration\",\"allowedValues\":\"ciwwzjuqkhr\",\"source\":\"jiwkuofoskghsau\",\"isDynamicConfig\":true,\"isReadOnly\":false,\"isConfigPendingRestart\":true,\"unit\":\"eduugi\",\"documentationLink\":\"jrrfbyaosve\"}") - .toObject(ConfigurationProperties.class); - Assertions.assertEquals("qzbqjvsov", model.value()); - Assertions.assertEquals("jiwkuofoskghsau", model.source()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConfigurationProperties model = - new ConfigurationProperties().withValue("qzbqjvsov").withSource("jiwkuofoskghsau"); - model = BinaryData.fromObject(model).toObject(ConfigurationProperties.class); - Assertions.assertEquals("qzbqjvsov", model.value()); - Assertions.assertEquals("jiwkuofoskghsau", model.source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetWithResponseMockTests.java deleted file mode 100644 index 84bc4a441e540..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetWithResponseMockTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ConfigurationsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"value\":\"uxvypomgkopkwh\",\"description\":\"v\",\"defaultValue\":\"jqg\",\"dataType\":\"Numeric\",\"allowedValues\":\"ocmbqfqvmkcxoza\",\"source\":\"helxprglya\",\"isDynamicConfig\":false,\"isReadOnly\":false,\"isConfigPendingRestart\":true,\"unit\":\"uejrjxgc\",\"documentationLink\":\"ibrhosxsdqr\"},\"id\":\"o\",\"name\":\"m\",\"type\":\"bmrqyibahwfl\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Configuration response = - manager - .configurations() - .getWithResponse("iyzvqtmnub", "xkp", "ksmond", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("uxvypomgkopkwh", response.value()); - Assertions.assertEquals("helxprglya", response.source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerMockTests.java deleted file mode 100644 index 24aab3bc215ef..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerMockTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ConfigurationsListByServerMockTests { - @Test - public void testListByServer() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"value\":\"pcjwv\",\"description\":\"dldwmgxc\",\"defaultValue\":\"slpmutwuo\",\"dataType\":\"Numeric\",\"allowedValues\":\"khjwn\",\"source\":\"qsluicp\",\"isDynamicConfig\":false,\"isReadOnly\":true,\"isConfigPendingRestart\":true,\"unit\":\"mbmpaxmodfvuefy\",\"documentationLink\":\"bpfvm\"},\"id\":\"hrfou\",\"name\":\"ft\",\"type\":\"akcp\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.configurations().listByServer("pkeqdcvdrhvoo", "sotbob", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("pcjwv", response.iterator().next().value()); - Assertions.assertEquals("qsluicp", response.iterator().next().source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutMockTests.java deleted file mode 100644 index 591e47b9d0c3e..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ConfigurationsPutMockTests { - @Test - public void testPut() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"value\":\"kpw\",\"description\":\"eqnovvqfovl\",\"defaultValue\":\"ywsuwsy\",\"dataType\":\"Integer\",\"allowedValues\":\"sytgadgvraea\",\"source\":\"e\",\"isDynamicConfig\":false,\"isReadOnly\":true,\"isConfigPendingRestart\":true,\"unit\":\"q\",\"documentationLink\":\"ijfqkacewiipfp\"},\"id\":\"ji\",\"name\":\"wwiftohqkvpuv\",\"type\":\"sgplsakn\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Configuration response = - manager - .configurations() - .define("piexpbtgiw") - .withExistingFlexibleServer("szdtmhrkwof", "yvoqa") - .withValue("enwash") - .withSource("byuqerpqlp") - .create(); - - Assertions.assertEquals("kpw", response.value()); - Assertions.assertEquals("e", response.source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabaseInnerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabaseInnerTests.java deleted file mode 100644 index 4382a8364781e..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabaseInnerTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.DatabaseInner; -import org.junit.jupiter.api.Assertions; - -public final class DatabaseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DatabaseInner model = - BinaryData - .fromString( - "{\"properties\":{\"charset\":\"ou\",\"collation\":\"vudwtiukbldng\"},\"id\":\"ocipazyxoeg\",\"name\":\"kgjn\",\"type\":\"iucgygevqzn\"}") - .toObject(DatabaseInner.class); - Assertions.assertEquals("ou", model.charset()); - Assertions.assertEquals("vudwtiukbldng", model.collation()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DatabaseInner model = new DatabaseInner().withCharset("ou").withCollation("vudwtiukbldng"); - model = BinaryData.fromObject(model).toObject(DatabaseInner.class); - Assertions.assertEquals("ou", model.charset()); - Assertions.assertEquals("vudwtiukbldng", model.collation()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabaseListResultTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabaseListResultTests.java deleted file mode 100644 index acee74c70a411..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabaseListResultTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.DatabaseInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.DatabaseListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DatabaseListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DatabaseListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"charset\":\"yhxdeoejzicwi\",\"collation\":\"jttgzf\"},\"id\":\"shcbkhajdeyeamdp\",\"name\":\"agalpbuxwgipwhon\",\"type\":\"wkgshwa\"},{\"properties\":{\"charset\":\"xzbinjeputt\",\"collation\":\"ywnuzoq\"},\"id\":\"iyqzrnk\",\"name\":\"qvyxlwhzlsicoho\",\"type\":\"qnwvlrya\"},{\"properties\":{\"charset\":\"heun\",\"collation\":\"qhgyxzkonocukok\"},\"id\":\"axuconuq\",\"name\":\"zf\",\"type\":\"beypewrmjmw\"},{\"properties\":{\"charset\":\"ektcxsen\",\"collation\":\"lrsf\"},\"id\":\"zpwv\",\"name\":\"qdqgbi\",\"type\":\"ylihkaetckt\"}],\"nextLink\":\"civfsnkymuctq\"}") - .toObject(DatabaseListResult.class); - Assertions.assertEquals("yhxdeoejzicwi", model.value().get(0).charset()); - Assertions.assertEquals("jttgzf", model.value().get(0).collation()); - Assertions.assertEquals("civfsnkymuctq", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DatabaseListResult model = - new DatabaseListResult() - .withValue( - Arrays - .asList( - new DatabaseInner().withCharset("yhxdeoejzicwi").withCollation("jttgzf"), - new DatabaseInner().withCharset("xzbinjeputt").withCollation("ywnuzoq"), - new DatabaseInner().withCharset("heun").withCollation("qhgyxzkonocukok"), - new DatabaseInner().withCharset("ektcxsen").withCollation("lrsf"))) - .withNextLink("civfsnkymuctq"); - model = BinaryData.fromObject(model).toObject(DatabaseListResult.class); - Assertions.assertEquals("yhxdeoejzicwi", model.value().get(0).charset()); - Assertions.assertEquals("jttgzf", model.value().get(0).collation()); - Assertions.assertEquals("civfsnkymuctq", model.nextLink()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasePropertiesTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasePropertiesTests.java deleted file mode 100644 index 00348a8366eb1..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasePropertiesTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.DatabaseProperties; -import org.junit.jupiter.api.Assertions; - -public final class DatabasePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DatabaseProperties model = - BinaryData - .fromString("{\"charset\":\"pmr\",\"collation\":\"izcdrqjsd\"}") - .toObject(DatabaseProperties.class); - Assertions.assertEquals("pmr", model.charset()); - Assertions.assertEquals("izcdrqjsd", model.collation()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DatabaseProperties model = new DatabaseProperties().withCharset("pmr").withCollation("izcdrqjsd"); - model = BinaryData.fromObject(model).toObject(DatabaseProperties.class); - Assertions.assertEquals("pmr", model.charset()); - Assertions.assertEquals("izcdrqjsd", model.collation()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateMockTests.java deleted file mode 100644 index 99aa304b2d17b..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Database; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class DatabasesCreateMockTests { - @Test - public void testCreate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"charset\":\"v\",\"collation\":\"gpiohgwxrtfudxe\"},\"id\":\"gyqagvrvmnpkuk\",\"name\":\"himdbl\",\"type\":\"gwimfn\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Database response = - manager - .databases() - .define("z") - .withExistingFlexibleServer("lla", "melwuipiccjz") - .withCharset("vvcnayr") - .withCollation("rnxxmueed") - .create(); - - Assertions.assertEquals("v", response.charset()); - Assertions.assertEquals("gpiohgwxrtfudxe", response.collation()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteMockTests.java deleted file mode 100644 index 2be7205e02321..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class DatabasesDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.databases().delete("n", "synljphuopxodl", "iyntorzihle", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetWithResponseMockTests.java deleted file mode 100644 index ad3354a36f1fb..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetWithResponseMockTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Database; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class DatabasesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"charset\":\"uiizynke\",\"collation\":\"atrwyhqmibzyh\"},\"id\":\"tsmypyynpcdp\",\"name\":\"mnzgmwznmabi\",\"type\":\"nsorgjhxbldt\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Database response = - manager - .databases() - .getWithResponse("sjswsrms", "yzrpzbchckqqzq", "ox", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("uiizynke", response.charset()); - Assertions.assertEquals("atrwyhqmibzyh", response.collation()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerMockTests.java deleted file mode 100644 index 1d57eac3b5903..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerMockTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Database; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class DatabasesListByServerMockTests { - @Test - public void testListByServer() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"charset\":\"yhgsy\",\"collation\":\"ogjltdtbnnhad\"},\"id\":\"crkvcikhnv\",\"name\":\"amqgxqquezikyw\",\"type\":\"gxk\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.databases().listByServer("wwrlkdmtncv", "kotl", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("yhgsy", response.iterator().next().charset()); - Assertions.assertEquals("ogjltdtbnnhad", response.iterator().next().collation()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DelegatedSubnetUsageTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DelegatedSubnetUsageTests.java deleted file mode 100644 index a5241768df272..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DelegatedSubnetUsageTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.DelegatedSubnetUsage; - -public final class DelegatedSubnetUsageTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DelegatedSubnetUsage model = - BinaryData - .fromString("{\"subnetName\":\"bxwyjsflhhcaa\",\"usage\":8649013059747343935}") - .toObject(DelegatedSubnetUsage.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DelegatedSubnetUsage model = new DelegatedSubnetUsage(); - model = BinaryData.fromObject(model).toObject(DelegatedSubnetUsage.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FastProvisioningEditionCapabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FastProvisioningEditionCapabilityTests.java deleted file mode 100644 index 3af31c3668714..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FastProvisioningEditionCapabilityTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FastProvisioningEditionCapability; - -public final class FastProvisioningEditionCapabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FastProvisioningEditionCapability model = - BinaryData - .fromString( - "{\"supportedSku\":\"uhrzayvvt\",\"supportedStorageGb\":8189670768631717659,\"supportedServerVersions\":\"giotkftutqxlngx\"}") - .toObject(FastProvisioningEditionCapability.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FastProvisioningEditionCapability model = new FastProvisioningEditionCapability(); - model = BinaryData.fromObject(model).toObject(FastProvisioningEditionCapability.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRuleInnerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRuleInnerTests.java deleted file mode 100644 index a0c3ae7d160f2..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRuleInnerTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FirewallRuleInner; -import org.junit.jupiter.api.Assertions; - -public final class FirewallRuleInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FirewallRuleInner model = - BinaryData - .fromString( - "{\"properties\":{\"startIpAddress\":\"jf\",\"endIpAddress\":\"ebrjcxe\"},\"id\":\"uwutttxfvjrbi\",\"name\":\"phxepcyvahf\",\"type\":\"ljkyqxjvuuj\"}") - .toObject(FirewallRuleInner.class); - Assertions.assertEquals("jf", model.startIpAddress()); - Assertions.assertEquals("ebrjcxe", model.endIpAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FirewallRuleInner model = new FirewallRuleInner().withStartIpAddress("jf").withEndIpAddress("ebrjcxe"); - model = BinaryData.fromObject(model).toObject(FirewallRuleInner.class); - Assertions.assertEquals("jf", model.startIpAddress()); - Assertions.assertEquals("ebrjcxe", model.endIpAddress()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRuleListResultTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRuleListResultTests.java deleted file mode 100644 index b57025fa84e29..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRuleListResultTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FirewallRuleInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRuleListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class FirewallRuleListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FirewallRuleListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"startIpAddress\":\"txfvgx\",\"endIpAddress\":\"fsm\"},\"id\":\"eh\",\"name\":\"pvecxgodeb\",\"type\":\"qkkrb\"},{\"properties\":{\"startIpAddress\":\"pukgriwflzlfb\",\"endIpAddress\":\"zpuzycisp\"},\"id\":\"zahmgkbrpyydhibn\",\"name\":\"qqkpikadrg\",\"type\":\"tqagnbuynh\"},{\"properties\":{\"startIpAddress\":\"jggmebfsiarbu\",\"endIpAddress\":\"rcvpnazzmhjrunmp\"},\"id\":\"tdbhrbnla\",\"name\":\"kx\",\"type\":\"yskpbhen\"},{\"properties\":{\"startIpAddress\":\"tkcxywnytnrsy\",\"endIpAddress\":\"lqidyby\"},\"id\":\"zfcl\",\"name\":\"aaxdbabphlwrq\",\"type\":\"fkts\"}],\"nextLink\":\"sucocmnyyazttbtw\"}") - .toObject(FirewallRuleListResult.class); - Assertions.assertEquals("txfvgx", model.value().get(0).startIpAddress()); - Assertions.assertEquals("fsm", model.value().get(0).endIpAddress()); - Assertions.assertEquals("sucocmnyyazttbtw", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FirewallRuleListResult model = - new FirewallRuleListResult() - .withValue( - Arrays - .asList( - new FirewallRuleInner().withStartIpAddress("txfvgx").withEndIpAddress("fsm"), - new FirewallRuleInner().withStartIpAddress("pukgriwflzlfb").withEndIpAddress("zpuzycisp"), - new FirewallRuleInner() - .withStartIpAddress("jggmebfsiarbu") - .withEndIpAddress("rcvpnazzmhjrunmp"), - new FirewallRuleInner().withStartIpAddress("tkcxywnytnrsy").withEndIpAddress("lqidyby"))) - .withNextLink("sucocmnyyazttbtw"); - model = BinaryData.fromObject(model).toObject(FirewallRuleListResult.class); - Assertions.assertEquals("txfvgx", model.value().get(0).startIpAddress()); - Assertions.assertEquals("fsm", model.value().get(0).endIpAddress()); - Assertions.assertEquals("sucocmnyyazttbtw", model.nextLink()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulePropertiesTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulePropertiesTests.java deleted file mode 100644 index b8f13210f7629..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulePropertiesTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FirewallRuleProperties; -import org.junit.jupiter.api.Assertions; - -public final class FirewallRulePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FirewallRuleProperties model = - BinaryData - .fromString("{\"startIpAddress\":\"gidokgjljyoxgvcl\",\"endIpAddress\":\"bgsncghkjeszzhb\"}") - .toObject(FirewallRuleProperties.class); - Assertions.assertEquals("gidokgjljyoxgvcl", model.startIpAddress()); - Assertions.assertEquals("bgsncghkjeszzhb", model.endIpAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FirewallRuleProperties model = - new FirewallRuleProperties().withStartIpAddress("gidokgjljyoxgvcl").withEndIpAddress("bgsncghkjeszzhb"); - model = BinaryData.fromObject(model).toObject(FirewallRuleProperties.class); - Assertions.assertEquals("gidokgjljyoxgvcl", model.startIpAddress()); - Assertions.assertEquals("bgsncghkjeszzhb", model.endIpAddress()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateMockTests.java deleted file mode 100644 index 4179662f32399..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRule; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class FirewallRulesCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"startIpAddress\":\"nbyxbaaabjyv\",\"endIpAddress\":\"yffimrzrtuzqogs\"},\"id\":\"nevfdnw\",\"name\":\"wmewzsyy\",\"type\":\"euzsoi\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - FirewallRule response = - manager - .firewallRules() - .define("duhpk") - .withExistingFlexibleServer("rw", "yc") - .withStartIpAddress("kgymareqnajxqug") - .withEndIpAddress("hky") - .create(); - - Assertions.assertEquals("nbyxbaaabjyv", response.startIpAddress()); - Assertions.assertEquals("yffimrzrtuzqogs", response.endIpAddress()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteMockTests.java deleted file mode 100644 index 9a623a5e88517..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class FirewallRulesDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.firewallRules().delete("hfjx", "mszkkfo", "rey", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetWithResponseMockTests.java deleted file mode 100644 index 654b96ae2a615..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetWithResponseMockTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRule; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class FirewallRulesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"startIpAddress\":\"xbjhwuaanozjosph\",\"endIpAddress\":\"oulpjrv\"},\"id\":\"glrvimjwosytxi\",\"name\":\"cskfcktqumiekk\",\"type\":\"zzikhlyfjhdg\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - FirewallRule response = - manager - .firewallRules() - .getWithResponse("kzikfjawneaivxwc", "elpcirelsfeaenwa", "fatkld", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("xbjhwuaanozjosph", response.startIpAddress()); - Assertions.assertEquals("oulpjrv", response.endIpAddress()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerMockTests.java deleted file mode 100644 index 4e43d92099c3d..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerMockTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRule; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class FirewallRulesListByServerMockTests { - @Test - public void testListByServer() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"startIpAddress\":\"eqidbqfatpx\",\"endIpAddress\":\"lr\"},\"id\":\"yjmoadsu\",\"name\":\"arm\",\"type\":\"wdmjsjqbjhhyx\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.firewallRules().listByServer("gge", "dunyg", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("eqidbqfatpx", response.iterator().next().startIpAddress()); - Assertions.assertEquals("lr", response.iterator().next().endIpAddress()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FlexibleServerEditionCapabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FlexibleServerEditionCapabilityTests.java deleted file mode 100644 index b2f0dde53355f..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FlexibleServerEditionCapabilityTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerEditionCapability; - -public final class FlexibleServerEditionCapabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FlexibleServerEditionCapability model = - BinaryData - .fromString( - "{\"name\":\"qduujitcjczdz\",\"supportedStorageEditions\":[{\"name\":\"hkr\",\"supportedStorageMB\":[],\"status\":\"ppdsbdkvwrwj\"},{\"name\":\"usnhutje\",\"supportedStorageMB\":[],\"status\":\"ldhugjzzdatqxh\"}],\"supportedServerVersions\":[{\"name\":\"eablg\",\"supportedVersionsToUpgrade\":[\"ti\",\"ndv\",\"aozwyiftyhxhu\",\"okftyxolniwpwcuk\"],\"supportedVcores\":[],\"status\":\"iawxklry\"},{\"name\":\"wckbasyypnd\",\"supportedVersionsToUpgrade\":[\"gcbacphejkot\",\"nqgoulzndli\"],\"supportedVcores\":[],\"status\":\"kgfg\"},{\"name\":\"madgakeqsrxyb\",\"supportedVersionsToUpgrade\":[\"e\",\"qytbciq\",\"ouf\",\"mmnkzsmodmgl\"],\"supportedVcores\":[],\"status\":\"b\"}],\"status\":\"tmut\"}") - .toObject(FlexibleServerEditionCapability.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FlexibleServerEditionCapability model = new FlexibleServerEditionCapability(); - model = BinaryData.fromObject(model).toObject(FlexibleServerEditionCapability.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixesExecuteWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixesExecuteWithResponseMockTests.java deleted file mode 100644 index 26a3dd202316b..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixesExecuteWithResponseMockTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class GetPrivateDnsZoneSuffixesExecuteWithResponseMockTests { - @Test - public void testExecuteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "\"oxciqopidoamcio\""; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - String response = - manager.getPrivateDnsZoneSuffixes().executeWithResponse(com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("oxciqopidoamcio", response); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/HighAvailabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/HighAvailabilityTests.java deleted file mode 100644 index 69c89f5a0e56f..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/HighAvailabilityTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailabilityMode; -import org.junit.jupiter.api.Assertions; - -public final class HighAvailabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - HighAvailability model = - BinaryData - .fromString( - "{\"mode\":\"SameZone\",\"state\":\"FailingOver\",\"standbyAvailabilityZone\":\"xvnmicykvceov\"}") - .toObject(HighAvailability.class); - Assertions.assertEquals(HighAvailabilityMode.SAME_ZONE, model.mode()); - Assertions.assertEquals("xvnmicykvceov", model.standbyAvailabilityZone()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - HighAvailability model = - new HighAvailability() - .withMode(HighAvailabilityMode.SAME_ZONE) - .withStandbyAvailabilityZone("xvnmicykvceov"); - model = BinaryData.fromObject(model).toObject(HighAvailability.class); - Assertions.assertEquals(HighAvailabilityMode.SAME_ZONE, model.mode()); - Assertions.assertEquals("xvnmicykvceov", model.standbyAvailabilityZone()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/HyperscaleNodeEditionCapabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/HyperscaleNodeEditionCapabilityTests.java deleted file mode 100644 index 293b4bdb5356a..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/HyperscaleNodeEditionCapabilityTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HyperscaleNodeEditionCapability; - -public final class HyperscaleNodeEditionCapabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - HyperscaleNodeEditionCapability model = - BinaryData - .fromString( - "{\"name\":\"nohjt\",\"supportedStorageEditions\":[{\"name\":\"dsoifiyipj\",\"supportedStorageMB\":[],\"status\":\"pgrjbz\"},{\"name\":\"rcjxvsnbyxqabn\",\"supportedStorageMB\":[],\"status\":\"cyshurzafbljjgp\"},{\"name\":\"oq\",\"supportedStorageMB\":[],\"status\":\"ljavbqid\"}],\"supportedServerVersions\":[{\"name\":\"zyulp\",\"supportedVersionsToUpgrade\":[\"jkrlkhbzhfepg\"],\"supportedVcores\":[],\"status\":\"xzlocxscp\"},{\"name\":\"erhhbcsglumm\",\"supportedVersionsToUpgrade\":[\"j\",\"odxobnbdxkqpxok\",\"jionpimexgstxgc\"],\"supportedVcores\":[],\"status\":\"maajrmvdjwzrlo\"}],\"supportedNodeTypes\":[{\"name\":\"whijcoejctbza\",\"nodeType\":\"qsycbkbfkgu\",\"status\":\"kexxppof\"},{\"name\":\"axcfjpgddtocjjx\",\"nodeType\":\"pmouexhdz\",\"status\":\"bqe\"},{\"name\":\"nxqbzvddn\",\"nodeType\":\"ndei\",\"status\":\"twnpzaoqvuhrhcf\"},{\"name\":\"yd\",\"nodeType\":\"lmjthjq\",\"status\":\"pyeicxm\"}],\"status\":\"iwqvhkh\"}") - .toObject(HyperscaleNodeEditionCapability.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - HyperscaleNodeEditionCapability model = new HyperscaleNodeEditionCapability(); - model = BinaryData.fromObject(model).toObject(HyperscaleNodeEditionCapability.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteMockTests.java deleted file mode 100644 index 6038010cd7cde..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteMockTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilityProperties; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class LocationBasedCapabilitiesExecuteMockTests { - @Test - public void testExecute() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"zone\":\"qlfmmdnbb\",\"supportedHAMode\":[\"pswiydmcwyh\",\"dxssadbzm\",\"vdfznudaodvxzb\"],\"geoBackupSupported\":true,\"zoneRedundantHaSupported\":true,\"zoneRedundantHaAndGeoBackupSupported\":true,\"supportedFlexibleServerEditions\":[{\"name\":\"bhhxsrzdzuc\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"status\":\"t\"},{\"name\":\"vfiwjmygtdss\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"status\":\"eriofzpyqs\"},{\"name\":\"wab\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"status\":\"szhedplvw\"}],\"supportedHyperscaleNodeEditions\":[{\"name\":\"mwmbes\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"supportedNodeTypes\":[],\"status\":\"pjflcxogao\"},{\"name\":\"nzmnsikvm\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"supportedNodeTypes\":[],\"status\":\"l\"},{\"name\":\"zxmhhvhgu\",\"supportedStorageEditions\":[],\"supportedServerVersions\":[],\"supportedNodeTypes\":[],\"status\":\"dagxtibqd\"}],\"fastProvisioningSupported\":false,\"supportedFastProvisioningEditions\":[{\"supportedSku\":\"bogqxndlkzgxhu\",\"supportedStorageGb\":621942409607693787,\"supportedServerVersions\":\"podxunkb\"},{\"supportedSku\":\"xmubyyntwlrbq\",\"supportedStorageGb\":8060447161666090820,\"supportedServerVersions\":\"vseotgqrl\"},{\"supportedSku\":\"muwlauwzizxbm\",\"supportedStorageGb\":9118429342651119617,\"supportedServerVersions\":\"fuzmuvpbtt\"},{\"supportedSku\":\"morppxebmnzbtbh\",\"supportedStorageGb\":4679929570751619388,\"supportedServerVersions\":\"fgohdneuelfphs\"}],\"status\":\"htozfikdow\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.locationBasedCapabilities().execute("aolps", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MaintenanceWindowTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MaintenanceWindowTests.java deleted file mode 100644 index e5931b167b9f3..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/MaintenanceWindowTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; -import org.junit.jupiter.api.Assertions; - -public final class MaintenanceWindowTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MaintenanceWindow model = - BinaryData - .fromString( - "{\"customWindow\":\"lo\",\"startHour\":660644635,\"startMinute\":636252983,\"dayOfWeek\":1073138726}") - .toObject(MaintenanceWindow.class); - Assertions.assertEquals("lo", model.customWindow()); - Assertions.assertEquals(660644635, model.startHour()); - Assertions.assertEquals(636252983, model.startMinute()); - Assertions.assertEquals(1073138726, model.dayOfWeek()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MaintenanceWindow model = - new MaintenanceWindow() - .withCustomWindow("lo") - .withStartHour(660644635) - .withStartMinute(636252983) - .withDayOfWeek(1073138726); - model = BinaryData.fromObject(model).toObject(MaintenanceWindow.class); - Assertions.assertEquals("lo", model.customWindow()); - Assertions.assertEquals(660644635, model.startHour()); - Assertions.assertEquals(636252983, model.startMinute()); - Assertions.assertEquals(1073138726, model.dayOfWeek()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/NameAvailabilityInnerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/NameAvailabilityInnerTests.java deleted file mode 100644 index f675715e46ce9..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/NameAvailabilityInnerTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.NameAvailabilityInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilityReason; -import org.junit.jupiter.api.Assertions; - -public final class NameAvailabilityInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NameAvailabilityInner model = - BinaryData - .fromString( - "{\"name\":\"bhj\",\"type\":\"igeho\",\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"kanyktzlcuiywg\"}") - .toObject(NameAvailabilityInner.class); - Assertions.assertEquals(false, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, model.reason()); - Assertions.assertEquals("kanyktzlcuiywg", model.message()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NameAvailabilityInner model = - new NameAvailabilityInner() - .withNameAvailable(false) - .withReason(CheckNameAvailabilityReason.INVALID) - .withMessage("kanyktzlcuiywg"); - model = BinaryData.fromObject(model).toObject(NameAvailabilityInner.class); - Assertions.assertEquals(false, model.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, model.reason()); - Assertions.assertEquals("kanyktzlcuiywg", model.message()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/NetworkTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/NetworkTests.java deleted file mode 100644 index 860b75defc2cf..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/NetworkTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Network; -import org.junit.jupiter.api.Assertions; - -public final class NetworkTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Network model = - BinaryData - .fromString( - "{\"publicNetworkAccess\":\"Enabled\",\"delegatedSubnetResourceId\":\"zxuutkncwscwsvl\",\"privateDnsZoneArmResourceId\":\"togt\"}") - .toObject(Network.class); - Assertions.assertEquals("zxuutkncwscwsvl", model.delegatedSubnetResourceId()); - Assertions.assertEquals("togt", model.privateDnsZoneArmResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Network model = - new Network().withDelegatedSubnetResourceId("zxuutkncwscwsvl").withPrivateDnsZoneArmResourceId("togt"); - model = BinaryData.fromObject(model).toObject(Network.class); - Assertions.assertEquals("zxuutkncwscwsvl", model.delegatedSubnetResourceId()); - Assertions.assertEquals("togt", model.privateDnsZoneArmResourceId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/NodeTypeCapabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/NodeTypeCapabilityTests.java deleted file mode 100644 index 16a71de5f8944..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/NodeTypeCapabilityTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.NodeTypeCapability; - -public final class NodeTypeCapabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NodeTypeCapability model = - BinaryData - .fromString("{\"name\":\"uigdtopbobjog\",\"nodeType\":\"e\",\"status\":\"a\"}") - .toObject(NodeTypeCapability.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NodeTypeCapability model = new NodeTypeCapability(); - model = BinaryData.fromObject(model).toObject(NodeTypeCapability.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationDisplayTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationDisplayTests.java deleted file mode 100644 index 8336bbe6b195c..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationDisplayTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.OperationDisplay; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"rvxdjzlmw\",\"resource\":\"kvugfhzovawjvzun\",\"operation\":\"thnnpr\",\"description\":\"i\"}") - .toObject(OperationDisplay.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationListResultInnerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationListResultInnerTests.java deleted file mode 100644 index 15153af72b6ec..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationListResultInnerTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.OperationListResultInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Operation; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OperationListResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResultInner model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"rxsbkyvp\",\"display\":{\"provider\":\"n\",\"resource\":\"bpzkafkuwbc\",\"operation\":\"wbme\",\"description\":\"seyvj\"},\"isDataAction\":false,\"origin\":\"system\",\"properties\":{\"aofmxagkvtme\":\"dataspkdee\",\"c\":\"datamqkrhahvljuahaqu\",\"aex\":\"datahmdua\"}},{\"name\":\"vfadmws\",\"display\":{\"provider\":\"gvxp\",\"resource\":\"omzlfmi\",\"operation\":\"wbnb\",\"description\":\"ldawkzbaliourqha\"},\"isDataAction\":true,\"origin\":\"user\",\"properties\":{\"gicjooxdjeb\":\"datasfwxosowzxc\",\"ecivyh\":\"datapucwwfvovbvme\",\"ojgjrwjueiotwmc\":\"datace\",\"nrjawgqwg\":\"dataytdxwit\"}},{\"name\":\"ni\",\"display\":{\"provider\":\"fbkp\",\"resource\":\"gklwn\",\"operation\":\"hjdauwhvylwz\",\"description\":\"dhxujznbmpo\"},\"isDataAction\":false,\"origin\":\"system\",\"properties\":{\"alupjm\":\"datalve\",\"iplrbpbewtghfgb\":\"datahfxobbcswsrtj\",\"wxzvlvqhjkb\":\"datac\",\"iebwwaloayqcgwrt\":\"datagibtnm\"}}],\"nextLink\":\"uzgwyzmhtx\"}") - .toObject(OperationListResultInner.class); - Assertions.assertEquals(false, model.value().get(0).isDataAction()); - Assertions.assertEquals("uzgwyzmhtx", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResultInner model = - new OperationListResultInner() - .withValue( - Arrays - .asList( - new Operation().withIsDataAction(false), - new Operation().withIsDataAction(true), - new Operation().withIsDataAction(false))) - .withNextLink("uzgwyzmhtx"); - model = BinaryData.fromObject(model).toObject(OperationListResultInner.class); - Assertions.assertEquals(false, model.value().get(0).isDataAction()); - Assertions.assertEquals("uzgwyzmhtx", model.nextLink()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationTests.java deleted file mode 100644 index 0d3893d56c42f..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Operation; -import org.junit.jupiter.api.Assertions; - -public final class OperationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Operation model = - BinaryData - .fromString( - "{\"name\":\"gmtsavjcbpwxqpsr\",\"display\":{\"provider\":\"tguvriuhp\",\"resource\":\"mdyvxqtayriw\",\"operation\":\"oyq\",\"description\":\"xrmcqibycnojvk\"},\"isDataAction\":false,\"origin\":\"NotSpecified\",\"properties\":{\"hpvgqz\":\"datazvahapjy\"}}") - .toObject(Operation.class); - Assertions.assertEquals(false, model.isDataAction()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Operation model = new Operation().withIsDataAction(false); - model = BinaryData.fromObject(model).toObject(Operation.class); - Assertions.assertEquals(false, model.isDataAction()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListWithResponseMockTests.java deleted file mode 100644 index 07401133b9a78..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListWithResponseMockTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.OperationListResult; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class OperationsListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"name\":\"altol\",\"isDataAction\":true,\"origin\":\"system\",\"properties\":{\"pfuvglsbjjca\":\"datawcsdbnwdcfhucq\",\"t\":\"datavxb\",\"mr\":\"dataudutnco\",\"f\":\"dataxqtvcofu\"}},{\"name\":\"kgjubgdknnqvsazn\",\"isDataAction\":false,\"origin\":\"NotSpecified\",\"properties\":{\"uetae\":\"datagsahmkycgrauw\",\"movsmzlxwabmqoe\":\"datauruv\",\"vtpuqujmqlgk\":\"datakif\"}},{\"name\":\"tndoaongbjc\",\"isDataAction\":true,\"origin\":\"user\",\"properties\":{\"twwaezkojvdcpzf\":\"dataed\"}}],\"nextLink\":\"ouicybxarzgszu\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - OperationListResult response = - manager.operations().listWithResponse(com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals(true, response.value().get(0).isDataAction()); - Assertions.assertEquals("ouicybxarzgszu", response.nextLink()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/RestartParameterTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/RestartParameterTests.java deleted file mode 100644 index 826b921f66879..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/RestartParameterTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FailoverMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; -import org.junit.jupiter.api.Assertions; - -public final class RestartParameterTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RestartParameter model = - BinaryData - .fromString("{\"restartWithFailover\":true,\"failoverMode\":\"PlannedFailover\"}") - .toObject(RestartParameter.class); - Assertions.assertEquals(true, model.restartWithFailover()); - Assertions.assertEquals(FailoverMode.PLANNED_FAILOVER, model.failoverMode()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RestartParameter model = - new RestartParameter().withRestartWithFailover(true).withFailoverMode(FailoverMode.PLANNED_FAILOVER); - model = BinaryData.fromObject(model).toObject(RestartParameter.class); - Assertions.assertEquals(true, model.restartWithFailover()); - Assertions.assertEquals(FailoverMode.PLANNED_FAILOVER, model.failoverMode()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBackupInnerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBackupInnerTests.java deleted file mode 100644 index 13c031372dd17..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBackupInnerTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerBackupInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Origin; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class ServerBackupInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerBackupInner model = - BinaryData - .fromString( - "{\"properties\":{\"backupType\":\"Full\",\"completedTime\":\"2021-02-10T03:30:23Z\",\"source\":\"x\"},\"id\":\"ivyqniwbybrkxvd\",\"name\":\"mjgr\",\"type\":\"fwvuk\"}") - .toObject(ServerBackupInner.class); - Assertions.assertEquals(Origin.FULL, model.backupType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-10T03:30:23Z"), model.completedTime()); - Assertions.assertEquals("x", model.source()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerBackupInner model = - new ServerBackupInner() - .withBackupType(Origin.FULL) - .withCompletedTime(OffsetDateTime.parse("2021-02-10T03:30:23Z")) - .withSource("x"); - model = BinaryData.fromObject(model).toObject(ServerBackupInner.class); - Assertions.assertEquals(Origin.FULL, model.backupType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-10T03:30:23Z"), model.completedTime()); - Assertions.assertEquals("x", model.source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBackupListResultTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBackupListResultTests.java deleted file mode 100644 index bf6bad745cbbe..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBackupListResultTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerBackupInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Origin; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerBackupListResult; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ServerBackupListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerBackupListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"backupType\":\"Full\",\"completedTime\":\"2021-08-18T11:52:54Z\",\"source\":\"hkryhtn\"},\"id\":\"czwlokjyem\",\"name\":\"kvnipjoxz\",\"type\":\"nchgej\"}],\"nextLink\":\"odmailzyd\"}") - .toObject(ServerBackupListResult.class); - Assertions.assertEquals(Origin.FULL, model.value().get(0).backupType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-18T11:52:54Z"), model.value().get(0).completedTime()); - Assertions.assertEquals("hkryhtn", model.value().get(0).source()); - Assertions.assertEquals("odmailzyd", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerBackupListResult model = - new ServerBackupListResult() - .withValue( - Arrays - .asList( - new ServerBackupInner() - .withBackupType(Origin.FULL) - .withCompletedTime(OffsetDateTime.parse("2021-08-18T11:52:54Z")) - .withSource("hkryhtn"))) - .withNextLink("odmailzyd"); - model = BinaryData.fromObject(model).toObject(ServerBackupListResult.class); - Assertions.assertEquals(Origin.FULL, model.value().get(0).backupType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-18T11:52:54Z"), model.value().get(0).completedTime()); - Assertions.assertEquals("hkryhtn", model.value().get(0).source()); - Assertions.assertEquals("odmailzyd", model.nextLink()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBackupPropertiesTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBackupPropertiesTests.java deleted file mode 100644 index 7072c8edb8453..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBackupPropertiesTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerBackupProperties; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Origin; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class ServerBackupPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerBackupProperties model = - BinaryData - .fromString("{\"backupType\":\"Full\",\"completedTime\":\"2021-02-24T15:23:22Z\",\"source\":\"cs\"}") - .toObject(ServerBackupProperties.class); - Assertions.assertEquals(Origin.FULL, model.backupType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-24T15:23:22Z"), model.completedTime()); - Assertions.assertEquals("cs", model.source()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerBackupProperties model = - new ServerBackupProperties() - .withBackupType(Origin.FULL) - .withCompletedTime(OffsetDateTime.parse("2021-02-24T15:23:22Z")) - .withSource("cs"); - model = BinaryData.fromObject(model).toObject(ServerBackupProperties.class); - Assertions.assertEquals(Origin.FULL, model.backupType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-24T15:23:22Z"), model.completedTime()); - Assertions.assertEquals("cs", model.source()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerVersionCapabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerVersionCapabilityTests.java deleted file mode 100644 index 74f5805bf4d75..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerVersionCapabilityTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersionCapability; - -public final class ServerVersionCapabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerVersionCapability model = - BinaryData - .fromString( - "{\"name\":\"ufizuckyf\",\"supportedVersionsToUpgrade\":[\"fidfvzw\",\"zuhtymwisdkfthwx\",\"nteiwaopv\"],\"supportedVcores\":[{\"name\":\"c\",\"vCores\":4465069614160015486,\"supportedIops\":7874706781697000309,\"supportedMemoryPerVcoreMB\":4484717766489487799,\"status\":\"pymzidnsezcxtbzs\"},{\"name\":\"yc\",\"vCores\":7851183931824744763,\"supportedIops\":4763393061757508617,\"supportedMemoryPerVcoreMB\":190971854068748515,\"status\":\"iachbo\"}],\"status\":\"flnrosfqpteehzz\"}") - .toObject(ServerVersionCapability.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerVersionCapability model = new ServerVersionCapability(); - model = BinaryData.fromObject(model).toObject(ServerVersionCapability.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteMockTests.java deleted file mode 100644 index 23390304baaea..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ServersDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.servers().delete("judpfrxt", "thzvaytdwkqbrqu", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartMockTests.java deleted file mode 100644 index 36354dbcb7a1f..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartMockTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FailoverMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ServersRestartMockTests { - @Test - public void testRestart() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .servers() - .restart( - "lyls", - "xkqjnsjervt", - new RestartParameter().withRestartWithFailover(false).withFailoverMode(FailoverMode.FORCED_FAILOVER), - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartMockTests.java deleted file mode 100644 index edd0a88c33e6d..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ServersStartMockTests { - @Test - public void testStart() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.servers().start("dszue", "psbzkfzbeyvpn", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopMockTests.java deleted file mode 100644 index d6dd24d858ab0..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ServersStopMockTests { - @Test - public void testStop() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.servers().stop("icvi", "v", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/SkuTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/SkuTests.java deleted file mode 100644 index 05493332916cf..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/SkuTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; -import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; -import org.junit.jupiter.api.Assertions; - -public final class SkuTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Sku model = - BinaryData.fromString("{\"name\":\"zxbzpfzabglc\",\"tier\":\"GeneralPurpose\"}").toObject(Sku.class); - Assertions.assertEquals("zxbzpfzabglc", model.name()); - Assertions.assertEquals(SkuTier.GENERAL_PURPOSE, model.tier()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Sku model = new Sku().withName("zxbzpfzabglc").withTier(SkuTier.GENERAL_PURPOSE); - model = BinaryData.fromObject(model).toObject(Sku.class); - Assertions.assertEquals("zxbzpfzabglc", model.name()); - Assertions.assertEquals(SkuTier.GENERAL_PURPOSE, model.tier()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageEditionCapabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageEditionCapabilityTests.java deleted file mode 100644 index a86f1ac7a89d0..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageEditionCapabilityTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageEditionCapability; - -public final class StorageEditionCapabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - StorageEditionCapability model = - BinaryData - .fromString( - "{\"name\":\"qktapspwgcuert\",\"supportedStorageMB\":[{\"name\":\"o\",\"supportedIops\":1712101311057870325,\"storageSizeMB\":4117897998779209947,\"supportedUpgradableTierList\":[],\"status\":\"bjf\"},{\"name\":\"gmbmbexppbh\",\"supportedIops\":7863810899973495328,\"storageSizeMB\":3040729179005507255,\"supportedUpgradableTierList\":[],\"status\":\"s\"}],\"status\":\"gbquxigj\"}") - .toObject(StorageEditionCapability.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - StorageEditionCapability model = new StorageEditionCapability(); - model = BinaryData.fromObject(model).toObject(StorageEditionCapability.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageMBCapabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageMBCapabilityTests.java deleted file mode 100644 index d10577f552b57..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageMBCapabilityTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageMBCapability; - -public final class StorageMBCapabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - StorageMBCapability model = - BinaryData - .fromString( - "{\"name\":\"gzjaoyfhrtxilne\",\"supportedIops\":7928784198213019505,\"storageSizeMB\":186603150154642680,\"supportedUpgradableTierList\":[{\"name\":\"uvfqawrlyxwj\",\"tierName\":\"prbnwbxgjvtbv\",\"iops\":7661305214436261701,\"isBaseline\":true,\"status\":\"rujqg\"}],\"status\":\"muouqfp\"}") - .toObject(StorageMBCapability.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - StorageMBCapability model = new StorageMBCapability(); - model = BinaryData.fromObject(model).toObject(StorageMBCapability.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageTests.java deleted file mode 100644 index d9f37e5d3f25e..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; -import org.junit.jupiter.api.Assertions; - -public final class StorageTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Storage model = BinaryData.fromString("{\"storageSizeGB\":1146165631}").toObject(Storage.class); - Assertions.assertEquals(1146165631, model.storageSizeGB()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Storage model = new Storage().withStorageSizeGB(1146165631); - model = BinaryData.fromObject(model).toObject(Storage.class); - Assertions.assertEquals(1146165631, model.storageSizeGB()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageTierCapabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageTierCapabilityTests.java deleted file mode 100644 index 9d13d55b6405f..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/StorageTierCapabilityTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageTierCapability; - -public final class StorageTierCapabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - StorageTierCapability model = - BinaryData - .fromString( - "{\"name\":\"zw\",\"tierName\":\"g\",\"iops\":4520848990140400139,\"isBaseline\":false,\"status\":\"zga\"}") - .toObject(StorageTierCapability.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - StorageTierCapability model = new StorageTierCapability(); - model = BinaryData.fromObject(model).toObject(StorageTierCapability.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/UserAssignedIdentityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/UserAssignedIdentityTests.java deleted file mode 100644 index c7a2dd4287af5..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/UserAssignedIdentityTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.IdentityType; -import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity; -import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class UserAssignedIdentityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserAssignedIdentity model = - BinaryData - .fromString( - "{\"userAssignedIdentities\":{\"zbhvgyuguosv\":{\"principalId\":\"ctyqik\",\"clientId\":\"bovpl\"},\"wiyighxpkdw\":{\"principalId\":\"fssxqukkfplg\",\"clientId\":\"sxnkjzkdeslpvlo\"}},\"type\":\"UserAssigned\"}") - .toObject(UserAssignedIdentity.class); - Assertions.assertEquals("ctyqik", model.userAssignedIdentities().get("zbhvgyuguosv").principalId()); - Assertions.assertEquals("bovpl", model.userAssignedIdentities().get("zbhvgyuguosv").clientId()); - Assertions.assertEquals(IdentityType.USER_ASSIGNED, model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserAssignedIdentity model = - new UserAssignedIdentity() - .withUserAssignedIdentities( - mapOf( - "zbhvgyuguosv", - new UserIdentity().withPrincipalId("ctyqik").withClientId("bovpl"), - "wiyighxpkdw", - new UserIdentity().withPrincipalId("fssxqukkfplg").withClientId("sxnkjzkdeslpvlo"))) - .withType(IdentityType.USER_ASSIGNED); - model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); - Assertions.assertEquals("ctyqik", model.userAssignedIdentities().get("zbhvgyuguosv").principalId()); - Assertions.assertEquals("bovpl", model.userAssignedIdentities().get("zbhvgyuguosv").clientId()); - Assertions.assertEquals(IdentityType.USER_ASSIGNED, model.type()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/UserIdentityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/UserIdentityTests.java deleted file mode 100644 index 9f68b711f5131..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/UserIdentityTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.UserIdentity; -import org.junit.jupiter.api.Assertions; - -public final class UserIdentityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserIdentity model = - BinaryData.fromString("{\"principalId\":\"iuebbaumny\",\"clientId\":\"ped\"}").toObject(UserIdentity.class); - Assertions.assertEquals("iuebbaumny", model.principalId()); - Assertions.assertEquals("ped", model.clientId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserIdentity model = new UserIdentity().withPrincipalId("iuebbaumny").withClientId("ped"); - model = BinaryData.fromObject(model).toObject(UserIdentity.class); - Assertions.assertEquals("iuebbaumny", model.principalId()); - Assertions.assertEquals("ped", model.clientId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VcoreCapabilityTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VcoreCapabilityTests.java deleted file mode 100644 index b26dd3c9084e8..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VcoreCapabilityTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VcoreCapability; - -public final class VcoreCapabilityTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VcoreCapability model = - BinaryData - .fromString( - "{\"name\":\"pyqr\",\"vCores\":298200283575892890,\"supportedIops\":2996229806276970298,\"supportedMemoryPerVcoreMB\":4254467677090741872,\"status\":\"kirsoodqxhc\"}") - .toObject(VcoreCapability.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VcoreCapability model = new VcoreCapability(); - model = BinaryData.fromObject(model).toObject(VcoreCapability.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageParameterTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageParameterTests.java deleted file mode 100644 index de0210a1eac67..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageParameterTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; -import org.junit.jupiter.api.Assertions; - -public final class VirtualNetworkSubnetUsageParameterTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VirtualNetworkSubnetUsageParameter model = - BinaryData - .fromString("{\"virtualNetworkArmResourceId\":\"zuaejxd\"}") - .toObject(VirtualNetworkSubnetUsageParameter.class); - Assertions.assertEquals("zuaejxd", model.virtualNetworkArmResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VirtualNetworkSubnetUsageParameter model = - new VirtualNetworkSubnetUsageParameter().withVirtualNetworkArmResourceId("zuaejxd"); - model = BinaryData.fromObject(model).toObject(VirtualNetworkSubnetUsageParameter.class); - Assertions.assertEquals("zuaejxd", model.virtualNetworkArmResourceId()); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageResultInnerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageResultInnerTests.java deleted file mode 100644 index 720554747d1f2..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageResultInnerTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; - -public final class VirtualNetworkSubnetUsageResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VirtualNetworkSubnetUsageResultInner model = - BinaryData - .fromString( - "{\"delegatedSubnetsUsage\":[{\"subnetName\":\"kzbbtd\",\"usage\":1585824709452414573},{\"subnetName\":\"ekg\",\"usage\":7805655437752275233},{\"subnetName\":\"hkfpbs\",\"usage\":2825814840016940868},{\"subnetName\":\"xl\",\"usage\":2245300278286998069}],\"location\":\"touwaboekqv\",\"subscriptionId\":\"lns\"}") - .toObject(VirtualNetworkSubnetUsageResultInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VirtualNetworkSubnetUsageResultInner model = new VirtualNetworkSubnetUsageResultInner(); - model = BinaryData.fromObject(model).toObject(VirtualNetworkSubnetUsageResultInner.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsagesExecuteWithResponseMockTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsagesExecuteWithResponseMockTests.java deleted file mode 100644 index 01e414a379a31..0000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsagesExecuteWithResponseMockTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageResult; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class VirtualNetworkSubnetUsagesExecuteWithResponseMockTests { - @Test - public void testExecuteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"delegatedSubnetsUsage\":[{\"subnetName\":\"kby\",\"usage\":813821040915840759},{\"subnetName\":\"fhpagmhrskdsnf\",\"usage\":8961529268746334450},{\"subnetName\":\"kgtdlmkkze\",\"usage\":1057392076331487418},{\"subnetName\":\"wpusdsttwvogv\",\"usage\":6615521098570079164}],\"location\":\"cngqqmoakufgmjz\",\"subscriptionId\":\"rdgrtw\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - PostgreSqlManager manager = - PostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - VirtualNetworkSubnetUsageResult response = - manager - .virtualNetworkSubnetUsages() - .executeWithResponse( - "lmnguxaw", - new VirtualNetworkSubnetUsageParameter().withVirtualNetworkArmResourceId("ldsyuuximerqfob"), - com.azure.core.util.Context.NONE) - .getValue(); - } -}