diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/CHANGELOG.md b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/CHANGELOG.md index 051a39612babb..0117758075583 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/CHANGELOG.md +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.1 (2022-07-26) + +- Azure Resource Manager MySql client library for Java. This package contains Microsoft Azure SDK for MySql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. Package tag package-2020-01-01. 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/README.md b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/README.md index ccae59c171aec..e6635b7cbb282 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/README.md +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/README.md @@ -2,7 +2,7 @@ Azure Resource Manager MySql client library for Java. -This package contains Microsoft Azure SDK for MySql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. Package tag package-flexibleserver-2021-05-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 MySql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. Package tag package-2020-01-01. 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-mysqlflexibleserver - 1.0.0-beta.2 + 1.0.0-beta.3 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/SAMPLE.md b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/SAMPLE.md index d330fa40650bb..7a21dc56dfe6c 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/SAMPLE.md +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/SAMPLE.md @@ -1,25 +1,20 @@ # Code snippets and samples -## Backups +## Advisors -- [Get](#backups_get) -- [ListByServer](#backups_listbyserver) +- [Get](#advisors_get) +- [ListByServer](#advisors_listbyserver) ## CheckNameAvailability - [Execute](#checknameavailability_execute) -## CheckVirtualNetworkSubnetUsage - -- [Execute](#checkvirtualnetworksubnetusage_execute) - ## Configurations -- [BatchUpdate](#configurations_batchupdate) +- [CreateOrUpdate](#configurations_createorupdate) - [Get](#configurations_get) - [ListByServer](#configurations_listbyserver) -- [Update](#configurations_update) ## Databases @@ -35,27 +30,94 @@ - [Get](#firewallrules_get) - [ListByServer](#firewallrules_listbyserver) -## GetPrivateDnsZoneSuffix +## LocationBasedPerformanceTier + +- [List](#locationbasedperformancetier_list) + +## LocationBasedRecommendedActionSessionsOperationStatus -- [Execute](#getprivatednszonesuffix_execute) +- [Get](#locationbasedrecommendedactionsessionsoperationstatus_get) -## LocationBasedCapabilities +## LocationBasedRecommendedActionSessionsResult -- [List](#locationbasedcapabilities_list) +- [List](#locationbasedrecommendedactionsessionsresult_list) + +## LogFiles + +- [ListByServer](#logfiles_listbyserver) ## Operations - [List](#operations_list) +## PrivateEndpointConnections + +- [CreateOrUpdate](#privateendpointconnections_createorupdate) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByServer](#privateendpointconnections_listbyserver) +- [UpdateTags](#privateendpointconnections_updatetags) + +## PrivateLinkResources + +- [Get](#privatelinkresources_get) +- [ListByServer](#privatelinkresources_listbyserver) + +## QueryTexts + +- [Get](#querytexts_get) +- [ListByServer](#querytexts_listbyserver) + +## RecommendedActions + +- [Get](#recommendedactions_get) +- [ListByServer](#recommendedactions_listbyserver) + +## RecoverableServers + +- [Get](#recoverableservers_get) + ## Replicas - [ListByServer](#replicas_listbyserver) +## ResourceProvider + +- [CreateRecommendedActionSession](#resourceprovider_createrecommendedactionsession) +- [ResetQueryPerformanceInsightData](#resourceprovider_resetqueryperformanceinsightdata) + +## ServerAdministrators + +- [CreateOrUpdate](#serveradministrators_createorupdate) +- [Delete](#serveradministrators_delete) +- [Get](#serveradministrators_get) +- [List](#serveradministrators_list) + +## ServerBasedPerformanceTier + +- [List](#serverbasedperformancetier_list) + +## ServerKeys + +- [CreateOrUpdate](#serverkeys_createorupdate) +- [Delete](#serverkeys_delete) +- [Get](#serverkeys_get) +- [List](#serverkeys_list) + +## ServerParameters + +- [ListUpdateConfigurations](#serverparameters_listupdateconfigurations) + +## ServerSecurityAlertPolicies + +- [CreateOrUpdate](#serversecurityalertpolicies_createorupdate) +- [Get](#serversecurityalertpolicies_get) +- [ListByServer](#serversecurityalertpolicies_listbyserver) + ## Servers - [Create](#servers_create) - [Delete](#servers_delete) -- [Failover](#servers_failover) - [GetByResourceGroup](#servers_getbyresourcegroup) - [List](#servers_list) - [ListByResourceGroup](#servers_listbyresourcegroup) @@ -63,44 +125,62 @@ - [Start](#servers_start) - [Stop](#servers_stop) - [Update](#servers_update) -### Backups_Get +- [Upgrade](#servers_upgrade) + +## TopQueryStatistics + +- [Get](#topquerystatistics_get) +- [ListByServer](#topquerystatistics_listbyserver) + +## VirtualNetworkRules + +- [CreateOrUpdate](#virtualnetworkrules_createorupdate) +- [Delete](#virtualnetworkrules_delete) +- [Get](#virtualnetworkrules_get) +- [ListByServer](#virtualnetworkrules_listbyserver) + +## WaitStatistics + +- [Get](#waitstatistics_get) +- [ListByServer](#waitstatistics_listbyserver) +### Advisors_Get ```java import com.azure.core.util.Context; -/** Samples for Backups Get. */ -public final class BackupsGetSamples { +/** Samples for Advisors Get. */ +public final class AdvisorsGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/BackupGet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/AdvisorsGet.json */ /** - * Sample code: Get a backup for a server. + * Sample code: AdvisorsGet. * * @param manager Entry point to MySqlManager. */ - public static void getABackupForAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.backups().getWithResponse("TestGroup", "mysqltestserver", "daily_20210615T160516", Context.NONE); + public static void advisorsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.advisors().getWithResponse("testResourceGroupName", "testServerName", "Index", Context.NONE); } } ``` -### Backups_ListByServer +### Advisors_ListByServer ```java import com.azure.core.util.Context; -/** Samples for Backups ListByServer. */ -public final class BackupsListByServerSamples { +/** Samples for Advisors ListByServer. */ +public final class AdvisorsListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/BackupsListByServer.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/AdvisorsListByServer.json */ /** - * Sample code: List backups for a server. + * Sample code: AdvisorsListByServer. * * @param manager Entry point to MySqlManager. */ - public static void listBackupsForAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.backups().listByServer("TestGroup", "mysqltestserver", Context.NONE); + public static void advisorsListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.advisors().listByServer("testResourceGroupName", "testServerName", Context.NONE); } } ``` @@ -114,85 +194,43 @@ import com.azure.resourcemanager.mysqlflexibleserver.models.NameAvailabilityRequ /** Samples for CheckNameAvailability Execute. */ public final class CheckNameAvailabilityExecuteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/CheckNameAvailability.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/CheckNameAvailability.json */ /** - * Sample code: Check name availability. + * Sample code: NameAvailability. * * @param manager Entry point to MySqlManager. */ - public static void checkNameAvailability(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void nameAvailability(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .checkNameAvailabilities() .executeWithResponse( - "SouthEastAsia", - new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforMySQL/flexibleServers"), - Context.NONE); - } -} -``` - -### CheckVirtualNetworkSubnetUsage_Execute - -```java -import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; - -/** Samples for CheckVirtualNetworkSubnetUsage Execute. */ -public final class CheckVirtualNetworkSubnetUsageExecuteSamples { - /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/CheckVirtualNetworkSubnetUsage.json - */ - /** - * Sample code: CheckVirtualNetworkSubnetUsage. - * - * @param manager Entry point to MySqlManager. - */ - public static void checkVirtualNetworkSubnetUsage( - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager - .checkVirtualNetworkSubnetUsages() - .executeWithResponse( - "WestUS", - new VirtualNetworkSubnetUsageParameter() - .withVirtualNetworkResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet"), - Context.NONE); + new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforMySQL"), Context.NONE); } } ``` -### Configurations_BatchUpdate +### Configurations_CreateOrUpdate ```java -import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationForBatchUpdate; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationListForBatchUpdate; -import java.util.Arrays; - -/** Samples for Configurations BatchUpdate. */ -public final class ConfigurationsBatchUpdateSamples { +/** Samples for Configurations CreateOrUpdate. */ +public final class ConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationsBatchUpdate.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json */ /** - * Sample code: ConfigurationList. + * Sample code: ConfigurationCreateOrUpdate. * * @param manager Entry point to MySqlManager. */ - public static void configurationList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void configurationCreateOrUpdate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .configurations() - .batchUpdate( - "testrg", - "mysqltestserver", - new ConfigurationListForBatchUpdate() - .withValue( - Arrays - .asList( - new ConfigurationForBatchUpdate().withName("event_scheduler").withValue("OFF"), - new ConfigurationForBatchUpdate().withName("div_precision_increment").withValue("8"))), - Context.NONE); + .define("event_scheduler") + .withExistingServer("TestGroup", "testserver") + .withValue("off") + .withSource("user-override") + .create(); } } ``` @@ -205,14 +243,14 @@ import com.azure.core.util.Context; /** Samples for Configurations Get. */ public final class ConfigurationsGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationGet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationGet.json */ /** - * Sample code: Get a configuration. + * Sample code: ConfigurationGet. * * @param manager Entry point to MySqlManager. */ - public static void getAConfiguration(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void configurationGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.configurations().getWithResponse("TestGroup", "testserver", "event_scheduler", Context.NONE); } } @@ -226,46 +264,15 @@ import com.azure.core.util.Context; /** Samples for Configurations ListByServer. */ public final class ConfigurationsListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationsListByServer.json - */ - /** - * Sample code: List all configurations for a server. - * - * @param manager Entry point to MySqlManager. - */ - public static void listAllConfigurationsForAServer( - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.configurations().listByServer("testrg", "mysqltestserver", Context.NONE); - } -} -``` - -### Configurations_Update - -```java -import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationSource; - -/** Samples for Configurations Update. */ -public final class ConfigurationsUpdateSamples { - /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationUpdate.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationListByServer.json */ /** - * Sample code: Update a user configuration. + * Sample code: ConfigurationList. * * @param manager Entry point to MySqlManager. */ - public static void updateAUserConfiguration(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager - .configurations() - .update( - "testrg", - "testserver", - "event_scheduler", - new ConfigurationInner().withValue("on").withSource(ConfigurationSource.USER_OVERRIDE), - Context.NONE); + public static void configurationList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.configurations().listByServer("testrg", "mysqltestsvc1", Context.NONE); } } ``` @@ -276,18 +283,18 @@ public final class ConfigurationsUpdateSamples { /** Samples for Databases CreateOrUpdate. */ public final class DatabasesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabaseCreate.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseCreate.json */ /** - * Sample code: Create a database. + * Sample code: DatabaseCreate. * * @param manager Entry point to MySqlManager. */ - public static void createADatabase(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void databaseCreate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .databases() .define("db1") - .withExistingFlexibleServer("TestGroup", "testserver") + .withExistingServer("TestGroup", "testserver") .withCharset("utf8") .withCollation("utf8_general_ci") .create(); @@ -303,14 +310,14 @@ import com.azure.core.util.Context; /** Samples for Databases Delete. */ public final class DatabasesDeleteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabaseDelete.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseDelete.json */ /** - * Sample code: Delete a database. + * Sample code: DatabaseDelete. * * @param manager Entry point to MySqlManager. */ - public static void deleteADatabase(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void databaseDelete(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.databases().delete("TestGroup", "testserver", "db1", Context.NONE); } } @@ -324,14 +331,14 @@ import com.azure.core.util.Context; /** Samples for Databases Get. */ public final class DatabasesGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabaseGet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseGet.json */ /** - * Sample code: Get a database. + * Sample code: DatabaseGet. * * @param manager Entry point to MySqlManager. */ - public static void getADatabase(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void databaseGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.databases().getWithResponse("TestGroup", "testserver", "db1", Context.NONE); } } @@ -345,14 +352,14 @@ import com.azure.core.util.Context; /** Samples for Databases ListByServer. */ public final class DatabasesListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabasesListByServer.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseListByServer.json */ /** - * Sample code: List databases in a server. + * Sample code: DatabaseList. * * @param manager Entry point to MySqlManager. */ - public static void listDatabasesInAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void databaseList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.databases().listByServer("TestGroup", "testserver", Context.NONE); } } @@ -364,18 +371,18 @@ public final class DatabasesListByServerSamples { /** Samples for FirewallRules CreateOrUpdate. */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRuleCreate.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleCreate.json */ /** - * Sample code: Create a firewall rule. + * Sample code: FirewallRuleCreate. * * @param manager Entry point to MySqlManager. */ - public static void createAFirewallRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void firewallRuleCreate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .firewallRules() .define("rule1") - .withExistingFlexibleServer("TestGroup", "testserver") + .withExistingServer("TestGroup", "testserver") .withStartIpAddress("0.0.0.0") .withEndIpAddress("255.255.255.255") .create(); @@ -391,14 +398,14 @@ import com.azure.core.util.Context; /** Samples for FirewallRules Delete. */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRuleDelete.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleDelete.json */ /** - * Sample code: Delete a firewall rule. + * Sample code: FirewallRuleDelete. * * @param manager Entry point to MySqlManager. */ - public static void deleteAFirewallRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void firewallRuleDelete(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.firewallRules().delete("TestGroup", "testserver", "rule1", Context.NONE); } } @@ -412,14 +419,14 @@ import com.azure.core.util.Context; /** Samples for FirewallRules Get. */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRuleGet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleGet.json */ /** - * Sample code: Get a firewall rule. + * Sample code: FirewallRuleGet. * * @param manager Entry point to MySqlManager. */ - public static void getAFirewallRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void firewallRuleGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.firewallRules().getWithResponse("TestGroup", "testserver", "rule1", Context.NONE); } } @@ -433,58 +440,105 @@ import com.azure.core.util.Context; /** Samples for FirewallRules ListByServer. */ public final class FirewallRulesListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRulesListByServer.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleListByServer.json */ /** - * Sample code: List all firewall rules in a server. + * Sample code: FirewallRuleList. * * @param manager Entry point to MySqlManager. */ - public static void listAllFirewallRulesInAServer( - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void firewallRuleList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.firewallRules().listByServer("TestGroup", "testserver", Context.NONE); } } ``` -### GetPrivateDnsZoneSuffix_Execute +### LocationBasedPerformanceTier_List + +```java +import com.azure.core.util.Context; + +/** Samples for LocationBasedPerformanceTier List. */ +public final class LocationBasedPerformanceTierListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/PerformanceTiersListByLocation.json + */ + /** + * Sample code: PerformanceTiersList. + * + * @param manager Entry point to MySqlManager. + */ + public static void performanceTiersList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.locationBasedPerformanceTiers().list("WestUS", Context.NONE); + } +} +``` + +### LocationBasedRecommendedActionSessionsOperationStatus_Get + +```java +import com.azure.core.util.Context; + +/** Samples for LocationBasedRecommendedActionSessionsOperationStatus Get. */ +public final class LocationBasedRecommendedActionSessionsOperationStatusGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionOperationStatus.json + */ + /** + * Sample code: RecommendedActionSessionOperationStatus. + * + * @param manager Entry point to MySqlManager. + */ + public static void recommendedActionSessionOperationStatus( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .locationBasedRecommendedActionSessionsOperationStatus() + .getWithResponse("WestUS", "aaaabbbb-cccc-dddd-0000-111122223333", Context.NONE); + } +} +``` + +### LocationBasedRecommendedActionSessionsResult_List ```java import com.azure.core.util.Context; -/** Samples for GetPrivateDnsZoneSuffix Execute. */ -public final class GetPrivateDnsZoneSuffixExecuteSamples { +/** Samples for LocationBasedRecommendedActionSessionsResult List. */ +public final class LocationBasedRecommendedActionSessionsResultListSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/GetPrivateDnsZoneSuffix.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionResult.json */ /** - * Sample code: GetPrivateDnsZoneSuffix. + * Sample code: RecommendedActionSessionResult. * * @param manager Entry point to MySqlManager. */ - public static void getPrivateDnsZoneSuffix(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.getPrivateDnsZoneSuffixes().executeWithResponse(Context.NONE); + public static void recommendedActionSessionResult( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .locationBasedRecommendedActionSessionsResults() + .list("WestUS", "aaaabbbb-cccc-dddd-0000-111122223333", Context.NONE); } } ``` -### LocationBasedCapabilities_List +### LogFiles_ListByServer ```java import com.azure.core.util.Context; -/** Samples for LocationBasedCapabilities List. */ -public final class LocationBasedCapabilitiesListSamples { +/** Samples for LogFiles ListByServer. */ +public final class LogFilesListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/CapabilitiesByLocationList.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/LogFileListByServer.json */ /** - * Sample code: CapabilitiesList. + * Sample code: LogFileList. * * @param manager Entry point to MySqlManager. */ - public static void capabilitiesList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.locationBasedCapabilities().list("WestUS", Context.NONE); + public static void logFileList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.logFiles().listByServer("TestGroup", "testserver", Context.NONE); } } ``` @@ -497,7 +551,7 @@ import com.azure.core.util.Context; /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/OperationsList.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/OperationList.json */ /** * Sample code: OperationList. @@ -505,174 +559,137 @@ public final class OperationsListSamples { * @param manager Entry point to MySqlManager. */ public static void operationList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.operations().list(Context.NONE); + manager.operations().listWithResponse(Context.NONE); } } ``` -### Replicas_ListByServer +### PrivateEndpointConnections_CreateOrUpdate ```java -import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; -/** Samples for Replicas ListByServer. */ -public final class ReplicasListByServerSamples { +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ReplicasListByServer.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json */ /** - * Sample code: List replicas for a server. + * Sample code: Approve or reject a private endpoint connection with a given name. * * @param manager Entry point to MySqlManager. */ - public static void listReplicasForAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.replicas().listByServer("TestGroup", "mysqltestserver", Context.NONE); + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServer("Default", "test-svr") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) + .create(); } } ``` -### Servers_Create +### PrivateEndpointConnections_Delete ```java -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.mysqlflexibleserver.models.Backup; -import com.azure.resourcemanager.mysqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryption; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryptionType; -import com.azure.resourcemanager.mysqlflexibleserver.models.EnableStatusEnum; -import com.azure.resourcemanager.mysqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.mysqlflexibleserver.models.HighAvailabilityMode; -import com.azure.resourcemanager.mysqlflexibleserver.models.Identity; -import com.azure.resourcemanager.mysqlflexibleserver.models.ManagedServiceIdentityType; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerVersion; -import com.azure.resourcemanager.mysqlflexibleserver.models.Sku; -import com.azure.resourcemanager.mysqlflexibleserver.models.SkuTier; -import com.azure.resourcemanager.mysqlflexibleserver.models.Storage; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; +import com.azure.core.util.Context; -/** Samples for Servers Create. */ -public final class ServersCreateSamples { +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreateReplica.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json */ /** - * Sample code: Create a replica server. + * Sample code: Deletes a private endpoint connection with a given name. * * @param manager Entry point to MySqlManager. */ - public static void createAReplicaServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager - .servers() - .define("replica-server") - .withRegion("SoutheastAsia") - .withExistingResourceGroup("testgr") - .withCreateMode(CreateMode.REPLICA) - .withSourceServerResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testgr/providers/Microsoft.DBforMySQL/flexibleServers/source-server") - .create(); + .privateEndpointConnections() + .delete("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); } +} +``` + +### PrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreate.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json */ /** - * Sample code: Create a new server. + * Sample code: Gets private endpoint connection. * * @param manager Entry point to MySqlManager. */ - public static void createANewServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager - .servers() - .define("mysqltestserver") - .withRegion("southeastasia") - .withExistingResourceGroup("testrg") - .withTags(mapOf("num", "1")) - .withSku(new Sku().withName("Standard_D2ds_v4").withTier(SkuTier.GENERAL_PURPOSE)) - .withAdministratorLogin("cloudsa") - .withAdministratorLoginPassword("your_password") - .withVersion(ServerVersion.FIVE_SEVEN) - .withAvailabilityZone("1") - .withCreateMode(CreateMode.DEFAULT) - .withStorage(new Storage().withStorageSizeGB(100).withIops(600).withAutoGrow(EnableStatusEnum.DISABLED)) - .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(EnableStatusEnum.DISABLED)) - .withHighAvailability( - new HighAvailability().withMode(HighAvailabilityMode.ZONE_REDUNDANT).withStandbyAvailabilityZone("3")) - .create(); + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); } +} +``` + +### PrivateEndpointConnections_ListByServer + +```java +import com.azure.core.util.Context; +/** Samples for PrivateEndpointConnections ListByServer. */ +public final class PrivateEndpointConnectionsListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreateWithBYOK.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json */ /** - * Sample code: Create a server with byok. + * Sample code: Gets list of private endpoint connections on a server. * * @param manager Entry point to MySqlManager. */ - public static void createAServerWithByok(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) - throws IOException { - manager - .servers() - .define("mysqltestserver") - .withRegion("southeastasia") - .withExistingResourceGroup("testrg") - .withTags(mapOf("num", "1")) - .withIdentity( - new Identity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity", - SerializerFactory - .createDefaultManagementSerializerAdapter() - .deserialize("{}", Object.class, SerializerEncoding.JSON)))) - .withSku(new Sku().withName("Standard_D2ds_v4").withTier(SkuTier.GENERAL_PURPOSE)) - .withAdministratorLogin("cloudsa") - .withAdministratorLoginPassword("your_password") - .withVersion(ServerVersion.FIVE_SEVEN) - .withAvailabilityZone("1") - .withCreateMode(CreateMode.DEFAULT) - .withDataEncryption( - new DataEncryption() - .withPrimaryUserAssignedIdentityId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity") - .withPrimaryKeyUri("https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a") - .withGeoBackupUserAssignedIdentityId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity") - .withGeoBackupKeyUri("https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a") - .withType(DataEncryptionType.AZURE_KEY_VAULT)) - .withStorage(new Storage().withStorageSizeGB(100).withIops(600).withAutoGrow(EnableStatusEnum.DISABLED)) - .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(EnableStatusEnum.DISABLED)) - .withHighAvailability( - new HighAvailability().withMode(HighAvailabilityMode.ZONE_REDUNDANT).withStandbyAvailabilityZone("3")) - .create(); + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); } +} +``` + +### PrivateEndpointConnections_UpdateTags + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointConnection; +import java.util.HashMap; +import java.util.Map; +/** Samples for PrivateEndpointConnections UpdateTags. */ +public final class PrivateEndpointConnectionsUpdateTagsSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreateWithPointInTimeRestore.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json */ /** - * Sample code: Create a server as a point in time restore. + * Sample code: Update private endpoint connection Tags. * * @param manager Entry point to MySqlManager. */ - public static void createAServerAsAPointInTimeRestore( + public static void updatePrivateEndpointConnectionTags( com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager - .servers() - .define("targetserver") - .withRegion("SoutheastAsia") - .withExistingResourceGroup("TargetResourceGroup") - .withTags(mapOf("num", "1")) - .withSku(new Sku().withName("Standard_D14_v2").withTier(SkuTier.GENERAL_PURPOSE)) - .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) - .withSourceServerResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/flexibleServers/sourceserver") - .withRestorePointInTime(OffsetDateTime.parse("2021-06-24T00:00:37.467Z")) - .create(); + PrivateEndpointConnection resource = + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "val1", "key2", "val2")).apply(); } @SuppressWarnings("unchecked") @@ -688,293 +705,701 @@ public final class ServersCreateSamples { } ``` -### Servers_Delete +### PrivateLinkResources_Get ```java import com.azure.core.util.Context; -/** Samples for Servers Delete. */ -public final class ServersDeleteSamples { +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerDelete.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json */ /** - * Sample code: Delete a server. + * Sample code: Gets a private link resource for MySQL. * * @param manager Entry point to MySqlManager. */ - public static void deleteAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().delete("TestGroup", "testserver", Context.NONE); + public static void getsAPrivateLinkResourceForMySQL( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); } } ``` -### Servers_Failover +### PrivateLinkResources_ListByServer ```java import com.azure.core.util.Context; -/** Samples for Servers Failover. */ -public final class ServersFailoverSamples { +/** Samples for PrivateLinkResources ListByServer. */ +public final class PrivateLinkResourcesListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerFailover.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json */ /** - * Sample code: Restart a server. + * Sample code: Gets private link resources for MySQL. * * @param manager Entry point to MySqlManager. */ - public static void restartAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().failover("TestGroup", "testserver", Context.NONE); + public static void getsPrivateLinkResourcesForMySQL( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); } } ``` -### Servers_GetByResourceGroup +### QueryTexts_Get ```java import com.azure.core.util.Context; -/** Samples for Servers GetByResourceGroup. */ -public final class ServersGetByResourceGroupSamples { +/** Samples for QueryTexts Get. */ +public final class QueryTextsGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerGetWithVnet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsGet.json */ /** - * Sample code: Get a server with vnet. + * Sample code: QueryTextsGet. * * @param manager Entry point to MySqlManager. */ - public static void getAServerWithVnet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE); + public static void queryTextsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.queryTexts().getWithResponse("testResourceGroupName", "testServerName", "1", Context.NONE); } +} +``` + +### QueryTexts_ListByServer +```java +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for QueryTexts ListByServer. */ +public final class QueryTextsListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerGet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsListByServer.json */ /** - * Sample code: Get a server. + * Sample code: QueryTextsListByServer. * * @param manager Entry point to MySqlManager. */ - public static void getAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE); + public static void queryTextsListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .queryTexts() + .listByServer("testResourceGroupName", "testServerName", Arrays.asList("1", "2"), Context.NONE); } } ``` -### Servers_List +### RecommendedActions_Get ```java import com.azure.core.util.Context; -/** Samples for Servers List. */ -public final class ServersListSamples { +/** Samples for RecommendedActions Get. */ +public final class RecommendedActionsGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServersList.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionsGet.json */ /** - * Sample code: List servers in a subscription. + * Sample code: RecommendedActionsGet. * * @param manager Entry point to MySqlManager. */ - public static void listServersInASubscription(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().list(Context.NONE); + public static void recommendedActionsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .recommendedActions() + .getWithResponse("testResourceGroupName", "testServerName", "Index", "Index-1", Context.NONE); } } ``` -### Servers_ListByResourceGroup +### RecommendedActions_ListByServer ```java import com.azure.core.util.Context; -/** Samples for Servers ListByResourceGroup. */ -public final class ServersListByResourceGroupSamples { +/** Samples for RecommendedActions ListByServer. */ +public final class RecommendedActionsListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServersListByResourceGroup.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionsListByServer.json */ /** - * Sample code: List servers in a resource group. + * Sample code: RecommendedActionsListByServer. * * @param manager Entry point to MySqlManager. */ - public static void listServersInAResourceGroup(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().listByResourceGroup("TestGroup", Context.NONE); + public static void recommendedActionsListByServer( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .recommendedActions() + .listByServer("testResourceGroupName", "testServerName", "Index", null, Context.NONE); } } ``` -### Servers_Restart +### RecoverableServers_Get ```java import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.models.EnableStatusEnum; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerRestartParameter; -/** Samples for Servers Restart. */ -public final class ServersRestartSamples { +/** Samples for RecoverableServers Get. */ +public final class RecoverableServersGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerRestart.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/RecoverableServersGet.json */ /** - * Sample code: Restart a server. + * Sample code: ReplicasListByServer. * * @param manager Entry point to MySqlManager. */ - public static void restartAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager - .servers() - .restart( - "TestGroup", - "testserver", - new ServerRestartParameter() - .withRestartWithFailover(EnableStatusEnum.ENABLED) - .withMaxFailoverSeconds(60), - Context.NONE); + public static void replicasListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.recoverableServers().getWithResponse("testrg", "testsvc4", Context.NONE); } } ``` -### Servers_Start +### Replicas_ListByServer ```java import com.azure.core.util.Context; -/** Samples for Servers Start. */ -public final class ServersStartSamples { +/** Samples for Replicas ListByServer. */ +public final class ReplicasListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerStart.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json */ /** - * Sample code: Start a server. + * Sample code: ReplicasListByServer. * * @param manager Entry point to MySqlManager. */ - public static void startAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().start("TestGroup", "testserver", Context.NONE); + public static void replicasListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.replicas().listByServer("TestGroup", "testmaster", Context.NONE); } } ``` -### Servers_Stop +### ResourceProvider_CreateRecommendedActionSession ```java import com.azure.core.util.Context; -/** Samples for Servers Stop. */ -public final class ServersStopSamples { +/** Samples for ResourceProvider CreateRecommendedActionSession. */ +public final class ResourceProviderCreateRecommendedActionSessionSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerStop.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionCreate.json */ /** - * Sample code: Stop a server. + * Sample code: RecommendedActionSessionCreate. * * @param manager Entry point to MySqlManager. */ - public static void stopAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().stop("TestGroup", "testserver", Context.NONE); + public static void recommendedActionSessionCreate( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .resourceProviders() + .createRecommendedActionSession( + "testResourceGroupName", "testServerName", "Index", "someDatabaseName", Context.NONE); } } ``` -### Servers_Update +### ResourceProvider_ResetQueryPerformanceInsightData ```java -import com.azure.core.management.serializer.SerializerFactory; import com.azure.core.util.Context; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryption; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryptionType; -import com.azure.resourcemanager.mysqlflexibleserver.models.EnableStatusEnum; -import com.azure.resourcemanager.mysqlflexibleserver.models.Identity; -import com.azure.resourcemanager.mysqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.mysqlflexibleserver.models.ManagedServiceIdentityType; -import com.azure.resourcemanager.mysqlflexibleserver.models.Server; -import com.azure.resourcemanager.mysqlflexibleserver.models.Storage; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -/** Samples for Servers Update. */ -public final class ServersUpdateSamples { +/** Samples for ResourceProvider ResetQueryPerformanceInsightData. */ +public final class ResourceProviderResetQueryPerformanceInsightDataSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerUpdateWithCustomerMaintenanceWindow.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryPerformanceInsightResetData.json */ /** - * Sample code: Update server customer maintenance window. + * Sample code: QueryPerformanceInsightResetData. * * @param manager Entry point to MySqlManager. */ - public static void updateServerCustomerMaintenanceWindow( + public static void queryPerformanceInsightResetData( com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - Server resource = - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE).getValue(); - resource - .update() - .withMaintenanceWindow( - new MaintenanceWindow() - .withCustomWindow("Enabled") - .withStartHour(8) - .withStartMinute(0) - .withDayOfWeek(1)) - .apply(); + manager + .resourceProviders() + .resetQueryPerformanceInsightDataWithResponse("testResourceGroupName", "testServerName", Context.NONE); } +} +``` + +### ServerAdministrators_CreateOrUpdate +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.AdministratorType; +import java.util.UUID; + +/** Samples for ServerAdministrators CreateOrUpdate. */ +public final class ServerAdministratorsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerUpdateWithBYOK.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json */ /** - * Sample code: Update server with byok. + * Sample code: ServerAdministratorCreate. * * @param manager Entry point to MySqlManager. */ - public static void updateServerWithByok(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) - throws IOException { - Server resource = - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE).getValue(); - resource - .update() - .withIdentity( - new Identity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity", - SerializerFactory - .createDefaultManagementSerializerAdapter() - .deserialize("{}", Object.class, SerializerEncoding.JSON)))) - .withDataEncryption( - new DataEncryption() - .withPrimaryUserAssignedIdentityId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity") - .withPrimaryKeyUri("https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a") - .withGeoBackupUserAssignedIdentityId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity") - .withGeoBackupKeyUri("https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a") - .withType(DataEncryptionType.AZURE_KEY_VAULT)) - .apply(); + public static void serverAdministratorCreate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverAdministrators() + .createOrUpdate( + "testrg", + "mysqltestsvc4", + new ServerAdministratorResourceInner() + .withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .withTenantId(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")), + Context.NONE); } +} +``` + +### ServerAdministrators_Delete + +```java +import com.azure.core.util.Context; +/** Samples for ServerAdministrators Delete. */ +public final class ServerAdministratorsDeleteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerUpdate.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminDelete.json */ /** - * Sample code: Update a server. + * Sample code: ServerAdministratorsDelete. * * @param manager Entry point to MySqlManager. */ - public static void updateAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - Server resource = - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE).getValue(); - resource - .update() - .withStorage(new Storage().withStorageSizeGB(30).withIops(200).withAutoGrow(EnableStatusEnum.DISABLED)) - .apply(); + public static void serverAdministratorsDelete(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverAdministrators().delete("testrg", "mysqltestsvc4", Context.NONE); } +} +``` - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { +### ServerAdministrators_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAdministrators Get. */ +public final class ServerAdministratorsGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminGet.json + */ + /** + * Sample code: ServerAdministratorGet. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverAdministratorGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverAdministrators().getWithResponse("testrg", "mysqltestsvc4", Context.NONE); + } +} +``` + +### ServerAdministrators_List + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAdministrators List. */ +public final class ServerAdministratorsListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminList.json + */ + /** + * Sample code: get a list of server administrators. + * + * @param manager Entry point to MySqlManager. + */ + public static void getAListOfServerAdministrators( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverAdministrators().list("testrg", "mysqltestsvc4", Context.NONE); + } +} +``` + +### ServerBasedPerformanceTier_List + +```java +import com.azure.core.util.Context; + +/** Samples for ServerBasedPerformanceTier List. */ +public final class ServerBasedPerformanceTierListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json + */ + /** + * Sample code: PerformanceTiersList. + * + * @param manager Entry point to MySqlManager. + */ + public static void performanceTiersList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverBasedPerformanceTiers().list("testrg", "mysqltestsvc1", Context.NONE); + } +} +``` + +### ServerKeys_CreateOrUpdate + +```java +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKeyType; + +/** Samples for ServerKeys CreateOrUpdate. */ +public final class ServerKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a MySQL Server key. + * + * @param manager Entry point to MySqlManager. + */ + public static void createsOrUpdatesAMySQLServerKey( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingServer("testserver", "testrg") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} +``` + +### ServerKeys_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerKeys Delete. */ +public final class ServerKeysDeleteSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyDelete.json + */ + /** + * Sample code: Delete the MySQL Server key. + * + * @param manager Entry point to MySqlManager. + */ + public static void deleteTheMySQLServerKey(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverKeys() + .delete("testserver", "someVault_someKey_01234567890123456789012345678901", "testrg", Context.NONE); + } +} +``` + +### ServerKeys_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerKeys Get. */ +public final class ServerKeysGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyGet.json + */ + /** + * Sample code: Get the MySQL Server key. + * + * @param manager Entry point to MySqlManager. + */ + public static void getTheMySQLServerKey(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverKeys() + .getWithResponse( + "testrg", "testserver", "someVault_someKey_01234567890123456789012345678901", Context.NONE); + } +} +``` + +### ServerKeys_List + +```java +import com.azure.core.util.Context; + +/** Samples for ServerKeys List. */ +public final class ServerKeysListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyList.json + */ + /** + * Sample code: List the keys for a MySQL Server. + * + * @param manager Entry point to MySqlManager. + */ + public static void listTheKeysForAMySQLServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverKeys().list("testrg", "testserver", Context.NONE); + } +} +``` + +### ServerParameters_ListUpdateConfigurations + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; + +/** Samples for ServerParameters ListUpdateConfigurations. */ +public final class ServerParametersListUpdateConfigurationsSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json + */ + /** + * Sample code: ConfigurationList. + * + * @param manager Entry point to MySqlManager. + */ + public static void configurationList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverParameters() + .listUpdateConfigurations("testrg", "mysqltestsvc1", new ConfigurationListResultInner(), Context.NONE); + } +} +``` + +### ServerSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicy; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicyState; +import java.util.Arrays; + +/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json + */ + /** + * Sample code: Update a server's threat detection policy with minimal parameters. + * + * @param manager Entry point to MySqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(ServerSecurityAlertPolicyState.DISABLED).withEmailAccountAdmins(true).apply(); + } + + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json + */ + /** + * Sample code: Update a server's threat detection policy with all parameters. + * + * @param manager Entry point to MySqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(ServerSecurityAlertPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} +``` + +### ServerSecurityAlertPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.SecurityAlertPolicyName; + +/** Samples for ServerSecurityAlertPolicies Get. */ +public final class ServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json + */ + /** + * Sample code: Get a server's threat detection policy. + * + * @param manager Entry point to MySqlManager. + */ + public static void getAServerSThreatDetectionPolicy( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### ServerSecurityAlertPolicies_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerSecurityAlertPolicies ListByServer. */ +public final class ServerSecurityAlertPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json + */ + /** + * Sample code: List the server's threat detection policies. + * + * @param manager Entry point to MySqlManager. + */ + public static void listTheServerSThreatDetectionPolicies( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + } +} +``` + +### Servers_Create + +```java +import com.azure.resourcemanager.mysqlflexibleserver.models.GeoRedundantBackup; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPropertiesForDefaultCreate; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPropertiesForGeoRestore; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPropertiesForReplica; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPropertiesForRestore; +import com.azure.resourcemanager.mysqlflexibleserver.models.Sku; +import com.azure.resourcemanager.mysqlflexibleserver.models.SkuTier; +import com.azure.resourcemanager.mysqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.StorageProfile; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Servers Create. */ +public final class ServersCreateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json + */ + /** + * Sample code: Create a replica server. + * + * @param manager Entry point to MySqlManager. + */ + public static void createAReplicaServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .servers() + .define("targetserver") + .withRegion("westus") + .withExistingResourceGroup("TargetResourceGroup") + .withProperties( + new ServerPropertiesForReplica() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver")) + .create(); + } + + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json + */ + /** + * Sample code: Create a server as a geo restore. + * + * @param manager Entry point to MySqlManager. + */ + public static void createAServerAsAGeoRestore(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .servers() + .define("targetserver") + .withRegion("westus") + .withExistingResourceGroup("TargetResourceGroup") + .withProperties( + new ServerPropertiesForGeoRestore() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver")) + .withTags(mapOf("ElasticServer", "1")) + .withSku( + new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) + .create(); + } + + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreate.json + */ + /** + * Sample code: Create a new server. + * + * @param manager Entry point to MySqlManager. + */ + public static void createANewServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .servers() + .define("mysqltestsvc4") + .withRegion("westus") + .withExistingResourceGroup("testrg") + .withProperties( + new ServerPropertiesForDefaultCreate() + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withStorageProfile( + new StorageProfile() + .withBackupRetentionDays(7) + .withGeoRedundantBackup(GeoRedundantBackup.ENABLED) + .withStorageMB(128000)) + .withAdministratorLogin("cloudsa") + .withAdministratorLoginPassword("")) + .withTags(mapOf("ElasticServer", "1")) + .withSku( + new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) + .create(); + } + + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json + */ + /** + * Sample code: Create a database as a point in time restore. + * + * @param manager Entry point to MySqlManager. + */ + public static void createADatabaseAsAPointInTimeRestore( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .servers() + .define("targetserver") + .withRegion("brazilsouth") + .withExistingResourceGroup("TargetResourceGroup") + .withProperties( + new ServerPropertiesForRestore() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver") + .withRestorePointInTime(OffsetDateTime.parse("2017-12-14T00:00:37.467Z"))) + .withTags(mapOf("ElasticServer", "1")) + .withSku( + new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) + .create(); + } + + @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]; @@ -986,3 +1411,416 @@ public final class ServersUpdateSamples { } ``` +### Servers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Servers Delete. */ +public final class ServersDeleteSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerDelete.json + */ + /** + * Sample code: ServerDelete. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverDelete(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().delete("TestGroup", "testserver", Context.NONE); + } +} +``` + +### Servers_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Servers GetByResourceGroup. */ +public final class ServersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json + */ + /** + * Sample code: ServerGet. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestsvc4", Context.NONE); + } +} +``` + +### Servers_List + +```java +import com.azure.core.util.Context; + +/** Samples for Servers List. */ +public final class ServersListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerList.json + */ + /** + * Sample code: ServerList. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().list(Context.NONE); + } +} +``` + +### Servers_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Servers ListByResourceGroup. */ +public final class ServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerListByResourceGroup.json + */ + /** + * Sample code: ServerListByResourceGroup. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverListByResourceGroup(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### Servers_Restart + +```java +import com.azure.core.util.Context; + +/** Samples for Servers Restart. */ +public final class ServersRestartSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerRestart.json + */ + /** + * Sample code: ServerRestart. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverRestart(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().restart("TestGroup", "testserver", Context.NONE); + } +} +``` + +### Servers_Start + +```java +import com.azure.core.util.Context; + +/** Samples for Servers Start. */ +public final class ServersStartSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerStart.json + */ + /** + * Sample code: ServerStart. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverStart(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().start("TestGroup", "testserver", Context.NONE); + } +} +``` + +### Servers_Stop + +```java +import com.azure.core.util.Context; + +/** Samples for Servers Stop. */ +public final class ServersStopSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerStop.json + */ + /** + * Sample code: ServerStop. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverStop(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().stop("TestGroup", "testserver", Context.NONE); + } +} +``` + +### Servers_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.Server; +import com.azure.resourcemanager.mysqlflexibleserver.models.SslEnforcementEnum; + +/** Samples for Servers Update. */ +public final class ServersUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerUpdate.json + */ + /** + * Sample code: ServerUpdate. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverUpdate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + Server resource = + manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestsvc4", Context.NONE).getValue(); + resource + .update() + .withAdministratorLoginPassword("") + .withSslEnforcement(SslEnforcementEnum.DISABLED) + .apply(); + } +} +``` + +### Servers_Upgrade + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerUpgradeParameters; + +/** Samples for Servers Upgrade. */ +public final class ServersUpgradeSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerUpgrade.json + */ + /** + * Sample code: ServerUpgrade. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverUpgrade(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .servers() + .upgrade( + "TestGroup", "testserver", new ServerUpgradeParameters().withTargetServerVersion("5.7"), Context.NONE); + } +} +``` + +### TopQueryStatistics_Get + +```java +import com.azure.core.util.Context; + +/** Samples for TopQueryStatistics Get. */ +public final class TopQueryStatisticsGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/TopQueryStatisticsGet.json + */ + /** + * Sample code: TopQueryStatisticsGet. + * + * @param manager Entry point to MySqlManager. + */ + public static void topQueryStatisticsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .topQueryStatistics() + .getWithResponse( + "testResourceGroupName", + "testServerName", + "66-636923268000000000-636923277000000000-avg-duration", + Context.NONE); + } +} +``` + +### TopQueryStatistics_ListByServer + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.TopQueryStatisticsInput; +import java.time.OffsetDateTime; + +/** Samples for TopQueryStatistics ListByServer. */ +public final class TopQueryStatisticsListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/TopQueryStatisticsListByServer.json + */ + /** + * Sample code: TopQueryStatisticsListByServer. + * + * @param manager Entry point to MySqlManager. + */ + public static void topQueryStatisticsListByServer( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .topQueryStatistics() + .listByServer( + "testResourceGroupName", + "testServerName", + new TopQueryStatisticsInput() + .withNumberOfTopQueries(5) + .withAggregationFunction("avg") + .withObservedMetric("duration") + .withObservationStartTime(OffsetDateTime.parse("2019-05-01T20:00:00.000Z")) + .withObservationEndTime(OffsetDateTime.parse("2019-05-07T20:00:00.000Z")) + .withAggregationWindow("PT15M"), + Context.NONE); + } +} +``` + +### VirtualNetworkRules_CreateOrUpdate + +```java +/** Samples for VirtualNetworkRules CreateOrUpdate. */ +public final class VirtualNetworkRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json + */ + /** + * Sample code: Create or update a virtual network rule. + * + * @param manager Entry point to MySqlManager. + */ + public static void createOrUpdateAVirtualNetworkRule( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .virtualNetworkRules() + .define("vnet-firewall-rule") + .withExistingServer("TestGroup", "vnet-test-svr") + .withVirtualNetworkSubnetId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet") + .withIgnoreMissingVnetServiceEndpoint(false) + .create(); + } +} +``` + +### VirtualNetworkRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Delete. */ +public final class VirtualNetworkRulesDeleteSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json + */ + /** + * Sample code: Delete a virtual network rule. + * + * @param manager Entry point to MySqlManager. + */ + public static void deleteAVirtualNetworkRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.virtualNetworkRules().delete("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} +``` + +### VirtualNetworkRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Get. */ +public final class VirtualNetworkRulesGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json + */ + /** + * Sample code: Gets a virtual network rule. + * + * @param manager Entry point to MySqlManager. + */ + public static void getsAVirtualNetworkRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.virtualNetworkRules().getWithResponse("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} +``` + +### VirtualNetworkRules_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules ListByServer. */ +public final class VirtualNetworkRulesListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json + */ + /** + * Sample code: List virtual network rules. + * + * @param manager Entry point to MySqlManager. + */ + public static void listVirtualNetworkRules(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.virtualNetworkRules().listByServer("TestGroup", "vnet-test-svr", Context.NONE); + } +} +``` + +### WaitStatistics_Get + +```java +import com.azure.core.util.Context; + +/** Samples for WaitStatistics Get. */ +public final class WaitStatisticsGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/WaitStatisticsGet.json + */ + /** + * Sample code: WaitStatisticsGet. + * + * @param manager Entry point to MySqlManager. + */ + public static void waitStatisticsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .waitStatistics() + .getWithResponse( + "testResourceGroupName", + "testServerName", + "636927606000000000-636927615000000000-send-wait/io/socket/sql/client_connection-2--0", + Context.NONE); + } +} +``` + +### WaitStatistics_ListByServer + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatisticsInput; +import java.time.OffsetDateTime; + +/** Samples for WaitStatistics ListByServer. */ +public final class WaitStatisticsListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/WaitStatisticsListByServer.json + */ + /** + * Sample code: WaitStatisticsListByServer. + * + * @param manager Entry point to MySqlManager. + */ + public static void waitStatisticsListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .waitStatistics() + .listByServer( + "testResourceGroupName", + "testServerName", + new WaitStatisticsInput() + .withObservationStartTime(OffsetDateTime.parse("2019-05-01T20:00:00.000Z")) + .withObservationEndTime(OffsetDateTime.parse("2019-05-07T20:00:00.000Z")) + .withAggregationWindow("PT15M"), + Context.NONE); + } +} +``` + diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/pom.xml b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/pom.xml index d152208fdbf5b..f58513552dd2b 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/pom.xml +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/pom.xml @@ -13,7 +13,7 @@ jar Microsoft Azure SDK for MySql Management - This package contains Microsoft Azure SDK for MySql 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 MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. Package tag package-flexibleserver-2021-05-01. + This package contains Microsoft Azure SDK for MySql 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 MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. Package tag package-2020-01-01. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/MySqlManager.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/MySqlManager.java index 398c9f96ae927..62c5cc301529f 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/MySqlManager.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/MySqlManager.java @@ -10,11 +10,13 @@ import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; @@ -22,29 +24,59 @@ import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.mysqlflexibleserver.fluent.MySqlManagementClient; -import com.azure.resourcemanager.mysqlflexibleserver.implementation.BackupsImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.AdvisorsImpl; import com.azure.resourcemanager.mysqlflexibleserver.implementation.CheckNameAvailabilitiesImpl; -import com.azure.resourcemanager.mysqlflexibleserver.implementation.CheckVirtualNetworkSubnetUsagesImpl; import com.azure.resourcemanager.mysqlflexibleserver.implementation.ConfigurationsImpl; import com.azure.resourcemanager.mysqlflexibleserver.implementation.DatabasesImpl; import com.azure.resourcemanager.mysqlflexibleserver.implementation.FirewallRulesImpl; -import com.azure.resourcemanager.mysqlflexibleserver.implementation.GetPrivateDnsZoneSuffixesImpl; -import com.azure.resourcemanager.mysqlflexibleserver.implementation.LocationBasedCapabilitiesImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.LocationBasedPerformanceTiersImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.LocationBasedRecommendedActionSessionsOperationStatusImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.LocationBasedRecommendedActionSessionsResultsImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.LogFilesImpl; import com.azure.resourcemanager.mysqlflexibleserver.implementation.MySqlManagementClientBuilder; import com.azure.resourcemanager.mysqlflexibleserver.implementation.OperationsImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.QueryTextsImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.RecommendedActionsImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.RecoverableServersImpl; import com.azure.resourcemanager.mysqlflexibleserver.implementation.ReplicasImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.ServerAdministratorsImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.ServerBasedPerformanceTiersImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.ServerKeysImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.ServerParametersImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.ServerSecurityAlertPoliciesImpl; import com.azure.resourcemanager.mysqlflexibleserver.implementation.ServersImpl; -import com.azure.resourcemanager.mysqlflexibleserver.models.Backups; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.TopQueryStatisticsImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.VirtualNetworkRulesImpl; +import com.azure.resourcemanager.mysqlflexibleserver.implementation.WaitStatisticsImpl; +import com.azure.resourcemanager.mysqlflexibleserver.models.Advisors; import com.azure.resourcemanager.mysqlflexibleserver.models.CheckNameAvailabilities; -import com.azure.resourcemanager.mysqlflexibleserver.models.CheckVirtualNetworkSubnetUsages; import com.azure.resourcemanager.mysqlflexibleserver.models.Configurations; import com.azure.resourcemanager.mysqlflexibleserver.models.Databases; import com.azure.resourcemanager.mysqlflexibleserver.models.FirewallRules; -import com.azure.resourcemanager.mysqlflexibleserver.models.GetPrivateDnsZoneSuffixes; -import com.azure.resourcemanager.mysqlflexibleserver.models.LocationBasedCapabilities; +import com.azure.resourcemanager.mysqlflexibleserver.models.LocationBasedPerformanceTiers; +import com.azure.resourcemanager.mysqlflexibleserver.models.LocationBasedRecommendedActionSessionsOperationStatus; +import com.azure.resourcemanager.mysqlflexibleserver.models.LocationBasedRecommendedActionSessionsResults; +import com.azure.resourcemanager.mysqlflexibleserver.models.LogFiles; import com.azure.resourcemanager.mysqlflexibleserver.models.Operations; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointConnections; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkResources; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryTexts; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecommendedActions; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecoverableServers; import com.azure.resourcemanager.mysqlflexibleserver.models.Replicas; +import com.azure.resourcemanager.mysqlflexibleserver.models.ResourceProviders; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerAdministrators; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerBasedPerformanceTiers; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKeys; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerParameters; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicies; import com.azure.resourcemanager.mysqlflexibleserver.models.Servers; +import com.azure.resourcemanager.mysqlflexibleserver.models.TopQueryStatistics; +import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkRules; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatistics; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -62,24 +94,54 @@ public final class MySqlManager { private Replicas replicas; - private Backups backups; - private FirewallRules firewallRules; + private VirtualNetworkRules virtualNetworkRules; + private Databases databases; private Configurations configurations; - private LocationBasedCapabilities locationBasedCapabilities; + private ServerParameters serverParameters; - private CheckVirtualNetworkSubnetUsages checkVirtualNetworkSubnetUsages; + private LogFiles logFiles; - private CheckNameAvailabilities checkNameAvailabilities; + private ServerAdministrators serverAdministrators; - private GetPrivateDnsZoneSuffixes getPrivateDnsZoneSuffixes; + private RecoverableServers recoverableServers; + + private ServerBasedPerformanceTiers serverBasedPerformanceTiers; + + private LocationBasedPerformanceTiers locationBasedPerformanceTiers; + + private CheckNameAvailabilities checkNameAvailabilities; private Operations operations; + private ServerSecurityAlertPolicies serverSecurityAlertPolicies; + + private QueryTexts queryTexts; + + private TopQueryStatistics topQueryStatistics; + + private WaitStatistics waitStatistics; + + private ResourceProviders resourceProviders; + + private Advisors advisors; + + private RecommendedActions recommendedActions; + + private LocationBasedRecommendedActionSessionsOperationStatus locationBasedRecommendedActionSessionsOperationStatus; + + private LocationBasedRecommendedActionSessionsResults locationBasedRecommendedActionSessionsResults; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkResources privateLinkResources; + + private ServerKeys serverKeys; + private final MySqlManagementClient clientObject; private MySqlManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -107,6 +169,19 @@ public static MySqlManager authenticate(TokenCredential credential, AzureProfile return configure().authenticate(credential, profile); } + /** + * Creates an instance of MySql service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the MySql service API instance. + */ + public static MySqlManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MySqlManager(httpPipeline, profile, null); + } + /** * Gets a Configurable instance that can be used to create MySqlManager with optional configuration. * @@ -125,6 +200,7 @@ public static final class Configurable { private final List policies = new ArrayList<>(); private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; + private RetryOptions retryOptions; private Duration defaultPollInterval; private Configurable() { @@ -185,6 +261,19 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { return this; } + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + /** * Sets the default poll interval, used when service does not provide "Retry-After" header. * @@ -218,7 +307,7 @@ public MySqlManager authenticate(TokenCredential credential, AzureProfile profil .append("-") .append("com.azure.resourcemanager.mysqlflexibleserver") .append("/") - .append("1.0.0-beta.2"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -236,10 +325,15 @@ public MySqlManager authenticate(TokenCredential credential, AzureProfile profil scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); } if (retryPolicy == null) { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } } List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); policies.add(new RequestIdPolicy()); policies .addAll( @@ -270,7 +364,11 @@ public MySqlManager authenticate(TokenCredential credential, AzureProfile profil } } - /** @return Resource collection API of Servers. */ + /** + * Gets the resource collection API of Servers. It manages Server. + * + * @return Resource collection API of Servers. + */ public Servers servers() { if (this.servers == null) { this.servers = new ServersImpl(clientObject.getServers(), this); @@ -278,7 +376,11 @@ public Servers servers() { return servers; } - /** @return Resource collection API of Replicas. */ + /** + * Gets the resource collection API of Replicas. + * + * @return Resource collection API of Replicas. + */ public Replicas replicas() { if (this.replicas == null) { this.replicas = new ReplicasImpl(clientObject.getReplicas(), this); @@ -286,15 +388,11 @@ public Replicas replicas() { return replicas; } - /** @return Resource collection API of Backups. */ - public Backups backups() { - if (this.backups == null) { - this.backups = new BackupsImpl(clientObject.getBackups(), this); - } - return backups; - } - - /** @return Resource collection API of FirewallRules. */ + /** + * Gets the resource collection API of FirewallRules. It manages FirewallRule. + * + * @return Resource collection API of FirewallRules. + */ public FirewallRules firewallRules() { if (this.firewallRules == null) { this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); @@ -302,7 +400,23 @@ public FirewallRules firewallRules() { return firewallRules; } - /** @return Resource collection API of Databases. */ + /** + * Gets the resource collection API of VirtualNetworkRules. It manages VirtualNetworkRule. + * + * @return Resource collection API of VirtualNetworkRules. + */ + public VirtualNetworkRules virtualNetworkRules() { + if (this.virtualNetworkRules == null) { + this.virtualNetworkRules = new VirtualNetworkRulesImpl(clientObject.getVirtualNetworkRules(), this); + } + return virtualNetworkRules; + } + + /** + * Gets the resource collection API of Databases. It manages Database. + * + * @return Resource collection API of Databases. + */ public Databases databases() { if (this.databases == null) { this.databases = new DatabasesImpl(clientObject.getDatabases(), this); @@ -310,7 +424,11 @@ public Databases databases() { return databases; } - /** @return Resource collection API of Configurations. */ + /** + * Gets the resource collection API of Configurations. It manages Configuration. + * + * @return Resource collection API of Configurations. + */ public Configurations configurations() { if (this.configurations == null) { this.configurations = new ConfigurationsImpl(clientObject.getConfigurations(), this); @@ -318,25 +436,85 @@ public Configurations configurations() { return configurations; } - /** @return Resource collection API of LocationBasedCapabilities. */ - public LocationBasedCapabilities locationBasedCapabilities() { - if (this.locationBasedCapabilities == null) { - this.locationBasedCapabilities = - new LocationBasedCapabilitiesImpl(clientObject.getLocationBasedCapabilities(), this); + /** + * Gets the resource collection API of ServerParameters. + * + * @return Resource collection API of ServerParameters. + */ + public ServerParameters serverParameters() { + if (this.serverParameters == null) { + this.serverParameters = new ServerParametersImpl(clientObject.getServerParameters(), this); + } + return serverParameters; + } + + /** + * 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 ServerAdministrators. + * + * @return Resource collection API of ServerAdministrators. + */ + public ServerAdministrators serverAdministrators() { + if (this.serverAdministrators == null) { + this.serverAdministrators = new ServerAdministratorsImpl(clientObject.getServerAdministrators(), this); + } + return serverAdministrators; + } + + /** + * Gets the resource collection API of RecoverableServers. + * + * @return Resource collection API of RecoverableServers. + */ + public RecoverableServers recoverableServers() { + if (this.recoverableServers == null) { + this.recoverableServers = new RecoverableServersImpl(clientObject.getRecoverableServers(), this); + } + return recoverableServers; + } + + /** + * Gets the resource collection API of ServerBasedPerformanceTiers. + * + * @return Resource collection API of ServerBasedPerformanceTiers. + */ + public ServerBasedPerformanceTiers serverBasedPerformanceTiers() { + if (this.serverBasedPerformanceTiers == null) { + this.serverBasedPerformanceTiers = + new ServerBasedPerformanceTiersImpl(clientObject.getServerBasedPerformanceTiers(), this); } - return locationBasedCapabilities; + return serverBasedPerformanceTiers; } - /** @return Resource collection API of CheckVirtualNetworkSubnetUsages. */ - public CheckVirtualNetworkSubnetUsages checkVirtualNetworkSubnetUsages() { - if (this.checkVirtualNetworkSubnetUsages == null) { - this.checkVirtualNetworkSubnetUsages = - new CheckVirtualNetworkSubnetUsagesImpl(clientObject.getCheckVirtualNetworkSubnetUsages(), this); + /** + * Gets the resource collection API of LocationBasedPerformanceTiers. + * + * @return Resource collection API of LocationBasedPerformanceTiers. + */ + public LocationBasedPerformanceTiers locationBasedPerformanceTiers() { + if (this.locationBasedPerformanceTiers == null) { + this.locationBasedPerformanceTiers = + new LocationBasedPerformanceTiersImpl(clientObject.getLocationBasedPerformanceTiers(), this); } - return checkVirtualNetworkSubnetUsages; + return locationBasedPerformanceTiers; } - /** @return Resource collection API of CheckNameAvailabilities. */ + /** + * Gets the resource collection API of CheckNameAvailabilities. + * + * @return Resource collection API of CheckNameAvailabilities. + */ public CheckNameAvailabilities checkNameAvailabilities() { if (this.checkNameAvailabilities == null) { this.checkNameAvailabilities = @@ -345,16 +523,11 @@ public CheckNameAvailabilities checkNameAvailabilities() { return checkNameAvailabilities; } - /** @return Resource collection API of GetPrivateDnsZoneSuffixes. */ - public GetPrivateDnsZoneSuffixes getPrivateDnsZoneSuffixes() { - if (this.getPrivateDnsZoneSuffixes == null) { - this.getPrivateDnsZoneSuffixes = - new GetPrivateDnsZoneSuffixesImpl(clientObject.getGetPrivateDnsZoneSuffixes(), this); - } - return getPrivateDnsZoneSuffixes; - } - - /** @return Resource collection API of Operations. */ + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ public Operations operations() { if (this.operations == null) { this.operations = new OperationsImpl(clientObject.getOperations(), this); @@ -362,6 +535,157 @@ public Operations operations() { return operations; } + /** + * Gets the resource collection API of ServerSecurityAlertPolicies. It manages ServerSecurityAlertPolicy. + * + * @return Resource collection API of ServerSecurityAlertPolicies. + */ + public ServerSecurityAlertPolicies serverSecurityAlertPolicies() { + if (this.serverSecurityAlertPolicies == null) { + this.serverSecurityAlertPolicies = + new ServerSecurityAlertPoliciesImpl(clientObject.getServerSecurityAlertPolicies(), this); + } + return serverSecurityAlertPolicies; + } + + /** + * Gets the resource collection API of QueryTexts. + * + * @return Resource collection API of QueryTexts. + */ + public QueryTexts queryTexts() { + if (this.queryTexts == null) { + this.queryTexts = new QueryTextsImpl(clientObject.getQueryTexts(), this); + } + return queryTexts; + } + + /** + * Gets the resource collection API of TopQueryStatistics. + * + * @return Resource collection API of TopQueryStatistics. + */ + public TopQueryStatistics topQueryStatistics() { + if (this.topQueryStatistics == null) { + this.topQueryStatistics = new TopQueryStatisticsImpl(clientObject.getTopQueryStatistics(), this); + } + return topQueryStatistics; + } + + /** + * Gets the resource collection API of WaitStatistics. + * + * @return Resource collection API of WaitStatistics. + */ + public WaitStatistics waitStatistics() { + if (this.waitStatistics == null) { + this.waitStatistics = new WaitStatisticsImpl(clientObject.getWaitStatistics(), this); + } + return waitStatistics; + } + + /** + * 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 Advisors. + * + * @return Resource collection API of Advisors. + */ + public Advisors advisors() { + if (this.advisors == null) { + this.advisors = new AdvisorsImpl(clientObject.getAdvisors(), this); + } + return advisors; + } + + /** + * Gets the resource collection API of RecommendedActions. + * + * @return Resource collection API of RecommendedActions. + */ + public RecommendedActions recommendedActions() { + if (this.recommendedActions == null) { + this.recommendedActions = new RecommendedActionsImpl(clientObject.getRecommendedActions(), this); + } + return recommendedActions; + } + + /** + * Gets the resource collection API of LocationBasedRecommendedActionSessionsOperationStatus. + * + * @return Resource collection API of LocationBasedRecommendedActionSessionsOperationStatus. + */ + public LocationBasedRecommendedActionSessionsOperationStatus + locationBasedRecommendedActionSessionsOperationStatus() { + if (this.locationBasedRecommendedActionSessionsOperationStatus == null) { + this.locationBasedRecommendedActionSessionsOperationStatus = + new LocationBasedRecommendedActionSessionsOperationStatusImpl( + clientObject.getLocationBasedRecommendedActionSessionsOperationStatus(), this); + } + return locationBasedRecommendedActionSessionsOperationStatus; + } + + /** + * Gets the resource collection API of LocationBasedRecommendedActionSessionsResults. + * + * @return Resource collection API of LocationBasedRecommendedActionSessionsResults. + */ + public LocationBasedRecommendedActionSessionsResults locationBasedRecommendedActionSessionsResults() { + if (this.locationBasedRecommendedActionSessionsResults == null) { + this.locationBasedRecommendedActionSessionsResults = + new LocationBasedRecommendedActionSessionsResultsImpl( + clientObject.getLocationBasedRecommendedActionSessionsResults(), this); + } + return locationBasedRecommendedActionSessionsResults; + } + + /** + * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * Gets the resource collection API of ServerKeys. It manages ServerKey. + * + * @return Resource collection API of ServerKeys. + */ + public ServerKeys serverKeys() { + if (this.serverKeys == null) { + this.serverKeys = new ServerKeysImpl(clientObject.getServerKeys(), this); + } + return serverKeys; + } + /** * @return Wrapped service client MySqlManagementClient providing direct access to the underlying auto-generated API * implementation, based on Azure REST API. diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/BackupsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/AdvisorsClient.java similarity index 71% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/BackupsClient.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/AdvisorsClient.java index 1651eb752a85e..ee63d775acf74 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/BackupsClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/AdvisorsClient.java @@ -9,55 +9,55 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerBackupInner; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.AdvisorInner; -/** An instance of this class provides access to all the operations defined in BackupsClient. */ -public interface BackupsClient { +/** An instance of this class provides access to all the operations defined in AdvisorsClient. */ +public interface AdvisorsClient { /** - * List all the backups for a given server. + * Get a recommendation action advisor. * * @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 advisorName The advisor name for recommendation action. * @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 server backup properties. + * @return a recommendation action advisor. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerBackupInner get(String resourceGroupName, String serverName, String backupName); + AdvisorInner get(String resourceGroupName, String serverName, String advisorName); /** - * List all the backups for a given server. + * Get a recommendation action advisor. * * @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 advisorName The advisor name for recommendation action. * @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 server backup properties along with {@link Response}. + * @return a recommendation action advisor along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse( - String resourceGroupName, String serverName, String backupName, Context context); + Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context); /** - * List all the backups for a given server. + * List recommendation action advisors. * * @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 server backups as paginated response with {@link PagedIterable}. + * @return a list of query statistics as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByServer(String resourceGroupName, String serverName); + PagedIterable listByServer(String resourceGroupName, String serverName); /** - * List all the backups for a given server. + * List recommendation action advisors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -65,8 +65,8 @@ Response getWithResponse( * @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 server backups as paginated response with {@link PagedIterable}. + * @return a list of query statistics as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java index 8e4c349aa51c4..9c849d43f643c 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java @@ -14,23 +14,21 @@ /** An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. */ public interface CheckNameAvailabilitiesClient { /** - * Check the availability of name for server. + * Check the availability of name for resource. * - * @param locationName The name of the location. - * @param nameAvailabilityRequest The required parameters for checking if server name is available. + * @param nameAvailabilityRequest The required parameters for checking if resource 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 resource name availability. */ @ServiceMethod(returns = ReturnType.SINGLE) - NameAvailabilityInner execute(String locationName, NameAvailabilityRequest nameAvailabilityRequest); + NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest); /** - * Check the availability of name for server. + * Check the availability of name for resource. * - * @param locationName The name of the location. - * @param nameAvailabilityRequest The required parameters for checking if server name is available. + * @param nameAvailabilityRequest The required parameters for checking if resource 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. @@ -39,5 +37,5 @@ public interface CheckNameAvailabilitiesClient { */ @ServiceMethod(returns = ReturnType.SINGLE) Response executeWithResponse( - String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context); + NameAvailabilityRequest nameAvailabilityRequest, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ConfigurationsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ConfigurationsClient.java index adfba6202bfa6..f834229ecddca 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ConfigurationsClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ConfigurationsClient.java @@ -12,8 +12,6 @@ import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationListForBatchUpdate; /** An instance of this class provides access to all the operations defined in ConfigurationsClient. */ public interface ConfigurationsClient { @@ -30,7 +28,7 @@ public interface ConfigurationsClient { * @return the {@link SyncPoller} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ConfigurationInner> beginUpdate( + SyncPoller, ConfigurationInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); /** @@ -47,7 +45,7 @@ SyncPoller, ConfigurationInner> beginUpdate( * @return the {@link SyncPoller} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ConfigurationInner> beginUpdate( + SyncPoller, ConfigurationInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String configurationName, @@ -67,7 +65,7 @@ SyncPoller, ConfigurationInner> beginUpdate( * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner update( + ConfigurationInner createOrUpdate( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); /** @@ -84,7 +82,7 @@ ConfigurationInner update( * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner update( + ConfigurationInner createOrUpdate( String resourceGroupName, String serverName, String configurationName, @@ -121,68 +119,6 @@ ConfigurationInner update( Response getWithResponse( String resourceGroupName, String serverName, String configurationName, Context context); - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @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 a list of server configurations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ConfigurationListResultInner> beginBatchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters); - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @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 a list of server configurations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ConfigurationListResultInner> beginBatchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context); - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @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 server configurations. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationListResultInner batchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters); - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @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 server configurations. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationListResultInner batchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context); - /** * List all the configurations in a given server. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/FirewallRulesClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/FirewallRulesClient.java index 15ea97f6690fc..23f18d3d0e675 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/FirewallRulesClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/FirewallRulesClient.java @@ -90,7 +90,7 @@ FirewallRuleInner createOrUpdate( Context context); /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -105,7 +105,7 @@ SyncPoller, Void> beginDelete( String resourceGroupName, String serverName, String firewallRuleName); /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -121,7 +121,7 @@ SyncPoller, Void> beginDelete( String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -134,7 +134,7 @@ SyncPoller, Void> beginDelete( void delete(String resourceGroupName, String serverName, String firewallRuleName); /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedPerformanceTiersClient.java similarity index 67% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedPerformanceTiersClient.java index b5c75b6801f1c..67ee7960fab23 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedPerformanceTiersClient.java @@ -8,34 +8,32 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; -/** An instance of this class provides access to all the operations defined in LocationBasedCapabilitiesClient. */ -public interface LocationBasedCapabilitiesClient { +/** An instance of this class provides access to all the operations defined in LocationBasedPerformanceTiersClient. */ +public interface LocationBasedPerformanceTiersClient { /** - * Get capabilities at specified location in a given subscription. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. * @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 at specified location in a given subscription as paginated response with {@link - * PagedIterable}. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String locationName); + PagedIterable list(String locationName); /** - * Get capabilities at specified location in a given subscription. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. * @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 at specified location in a given subscription as paginated response with {@link - * PagedIterable}. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String locationName, Context context); + PagedIterable list(String locationName, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/CheckVirtualNetworkSubnetUsagesClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedRecommendedActionSessionsOperationStatusClient.java similarity index 55% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/CheckVirtualNetworkSubnetUsagesClient.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedRecommendedActionSessionsOperationStatusClient.java index b76ef4d2322e3..56169eada07bd 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/CheckVirtualNetworkSubnetUsagesClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedRecommendedActionSessionsOperationStatusClient.java @@ -8,36 +8,38 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendedActionSessionsOperationStatusInner; -/** An instance of this class provides access to all the operations defined in CheckVirtualNetworkSubnetUsagesClient. */ -public interface CheckVirtualNetworkSubnetUsagesClient { +/** + * An instance of this class provides access to all the operations defined in + * LocationBasedRecommendedActionSessionsOperationStatusClient. + */ +public interface LocationBasedRecommendedActionSessionsOperationStatusClient { /** - * Get virtual network subnet usage for a given vNet resource id. + * Recommendation action session operation status. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param operationId The operation identifier. * @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 virtual network subnet usage for a given vNet resource id. + * @return recommendation action session operation status. */ @ServiceMethod(returns = ReturnType.SINGLE) - VirtualNetworkSubnetUsageResultInner execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); + RecommendedActionSessionsOperationStatusInner get(String locationName, String operationId); /** - * Get virtual network subnet usage for a given vNet resource id. + * Recommendation action session operation status. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param operationId The operation identifier. * @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 virtual network subnet usage for a given vNet resource id along with {@link Response}. + * @return recommendation action session operation status along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context); + Response getWithResponse( + String locationName, String operationId, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedRecommendedActionSessionsResultsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedRecommendedActionSessionsResultsClient.java new file mode 100644 index 0000000000000..22c8fe2a10a31 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LocationBasedRecommendedActionSessionsResultsClient.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner; + +/** + * An instance of this class provides access to all the operations defined in + * LocationBasedRecommendedActionSessionsResultsClient. + */ +public interface LocationBasedRecommendedActionSessionsResultsClient { + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @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 recommendation actions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String locationName, String operationId); + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @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 recommendation actions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String locationName, String operationId, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LogFilesClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LogFilesClient.java new file mode 100644 index 0000000000000..77b6d80fbb38f --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/LogFilesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.LogFileInner; + +/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +public interface LogFilesClient { + /** + * List all the 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 log files as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the 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 log files as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/MySqlManagementClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/MySqlManagementClient.java index 7906b29eb8174..96fa752ec0170 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/MySqlManagementClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/MySqlManagementClient.java @@ -23,13 +23,6 @@ public interface MySqlManagementClient { */ String getEndpoint(); - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - String getApiVersion(); - /** * Gets The HTTP pipeline to send requests through. * @@ -59,18 +52,18 @@ public interface MySqlManagementClient { ReplicasClient getReplicas(); /** - * Gets the BackupsClient object to access its operations. + * Gets the FirewallRulesClient object to access its operations. * - * @return the BackupsClient object. + * @return the FirewallRulesClient object. */ - BackupsClient getBackups(); + FirewallRulesClient getFirewallRules(); /** - * Gets the FirewallRulesClient object to access its operations. + * Gets the VirtualNetworkRulesClient object to access its operations. * - * @return the FirewallRulesClient object. + * @return the VirtualNetworkRulesClient object. */ - FirewallRulesClient getFirewallRules(); + VirtualNetworkRulesClient getVirtualNetworkRules(); /** * Gets the DatabasesClient object to access its operations. @@ -87,32 +80,53 @@ public interface MySqlManagementClient { ConfigurationsClient getConfigurations(); /** - * Gets the LocationBasedCapabilitiesClient object to access its operations. + * Gets the ServerParametersClient object to access its operations. * - * @return the LocationBasedCapabilitiesClient object. + * @return the ServerParametersClient object. */ - LocationBasedCapabilitiesClient getLocationBasedCapabilities(); + ServerParametersClient getServerParameters(); /** - * Gets the CheckVirtualNetworkSubnetUsagesClient object to access its operations. + * Gets the LogFilesClient object to access its operations. * - * @return the CheckVirtualNetworkSubnetUsagesClient object. + * @return the LogFilesClient object. */ - CheckVirtualNetworkSubnetUsagesClient getCheckVirtualNetworkSubnetUsages(); + LogFilesClient getLogFiles(); /** - * Gets the CheckNameAvailabilitiesClient object to access its operations. + * Gets the ServerAdministratorsClient object to access its operations. * - * @return the CheckNameAvailabilitiesClient object. + * @return the ServerAdministratorsClient object. */ - CheckNameAvailabilitiesClient getCheckNameAvailabilities(); + ServerAdministratorsClient getServerAdministrators(); + + /** + * Gets the RecoverableServersClient object to access its operations. + * + * @return the RecoverableServersClient object. + */ + RecoverableServersClient getRecoverableServers(); + + /** + * Gets the ServerBasedPerformanceTiersClient object to access its operations. + * + * @return the ServerBasedPerformanceTiersClient object. + */ + ServerBasedPerformanceTiersClient getServerBasedPerformanceTiers(); + + /** + * Gets the LocationBasedPerformanceTiersClient object to access its operations. + * + * @return the LocationBasedPerformanceTiersClient object. + */ + LocationBasedPerformanceTiersClient getLocationBasedPerformanceTiers(); /** - * Gets the GetPrivateDnsZoneSuffixesClient object to access its operations. + * Gets the CheckNameAvailabilitiesClient object to access its operations. * - * @return the GetPrivateDnsZoneSuffixesClient object. + * @return the CheckNameAvailabilitiesClient object. */ - GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes(); + CheckNameAvailabilitiesClient getCheckNameAvailabilities(); /** * Gets the OperationsClient object to access its operations. @@ -120,4 +134,89 @@ public interface MySqlManagementClient { * @return the OperationsClient object. */ OperationsClient getOperations(); + + /** + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ServerSecurityAlertPoliciesClient object. + */ + ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies(); + + /** + * Gets the QueryTextsClient object to access its operations. + * + * @return the QueryTextsClient object. + */ + QueryTextsClient getQueryTexts(); + + /** + * Gets the TopQueryStatisticsClient object to access its operations. + * + * @return the TopQueryStatisticsClient object. + */ + TopQueryStatisticsClient getTopQueryStatistics(); + + /** + * Gets the WaitStatisticsClient object to access its operations. + * + * @return the WaitStatisticsClient object. + */ + WaitStatisticsClient getWaitStatistics(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the AdvisorsClient object to access its operations. + * + * @return the AdvisorsClient object. + */ + AdvisorsClient getAdvisors(); + + /** + * Gets the RecommendedActionsClient object to access its operations. + * + * @return the RecommendedActionsClient object. + */ + RecommendedActionsClient getRecommendedActions(); + + /** + * Gets the LocationBasedRecommendedActionSessionsOperationStatusClient object to access its operations. + * + * @return the LocationBasedRecommendedActionSessionsOperationStatusClient object. + */ + LocationBasedRecommendedActionSessionsOperationStatusClient + getLocationBasedRecommendedActionSessionsOperationStatus(); + + /** + * Gets the LocationBasedRecommendedActionSessionsResultsClient object to access its operations. + * + * @return the LocationBasedRecommendedActionSessionsResultsClient object. + */ + LocationBasedRecommendedActionSessionsResultsClient getLocationBasedRecommendedActionSessionsResults(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the ServerKeysClient object to access its operations. + * + * @return the ServerKeysClient object. + */ + ServerKeysClient getServerKeys(); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/OperationsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/OperationsClient.java index 1dfe689d3e9a8..e437f6639b69d 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/OperationsClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/OperationsClient.java @@ -6,9 +6,9 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationInner; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationListResultInner; /** An instance of this class provides access to all the operations defined in OperationsClient. */ public interface OperationsClient { @@ -17,10 +17,10 @@ public interface OperationsClient { * * @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 resource provider operations as paginated response with {@link PagedIterable}. + * @return a list of resource provider operations. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + OperationListResultInner list(); /** * Lists all of the available REST API operations. @@ -29,8 +29,8 @@ public interface OperationsClient { * @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 resource provider operations as paginated response with {@link PagedIterable}. + * @return a list of resource provider operations along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/PrivateEndpointConnectionsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..fb4e1d82c7802 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.TagsObject; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner updateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner updateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context); + + /** + * Gets all private endpoint connections on a 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/PrivateLinkResourcesClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..1879063e1e2b4 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/PrivateLinkResourcesClient.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.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateLinkResourceInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources for MySQL 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 private link resources for MySQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for MySQL 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 private link resources for MySQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private link resource for MySQL server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for MySQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName); + + /** + * Gets a private link resource for MySQL server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for MySQL server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/QueryTextsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/QueryTextsClient.java new file mode 100644 index 0000000000000..24815f1999810 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/QueryTextsClient.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.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryTextInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in QueryTextsClient. */ +public interface QueryTextsClient { + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @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 Query Text. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryTextInner get(String resourceGroupName, String serverName, String queryId); + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @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 Query Text along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String queryId, Context context); + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @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 query texts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, List queryIds); + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @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 query texts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/RecommendedActionsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/RecommendedActionsClient.java new file mode 100644 index 0000000000000..c91670cfce014 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/RecommendedActionsClient.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner; + +/** An instance of this class provides access to all the operations defined in RecommendedActionsClient. */ +public interface RecommendedActionsClient { + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action name. + * @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 Recommendation Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendationActionInner get( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action name. + * @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 Recommendation Action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName, Context context); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @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 recommendation actions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @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 recommendation actions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/RecoverableServersClient.java similarity index 58% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/RecoverableServersClient.java index e7d9ca74478be..8e12e6153097d 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/RecoverableServersClient.java @@ -8,29 +8,35 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.GetPrivateDnsZoneSuffixResponseInner; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecoverableServerResourceInner; -/** An instance of this class provides access to all the operations defined in GetPrivateDnsZoneSuffixesClient. */ -public interface GetPrivateDnsZoneSuffixesClient { +/** An instance of this class provides access to all the operations defined in RecoverableServersClient. */ +public interface RecoverableServersClient { /** - * Get private DNS zone suffix in the cloud. + * Gets a recoverable MySQL 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 private DNS zone suffix in the cloud. + * @return a recoverable MySQL Server. */ @ServiceMethod(returns = ReturnType.SINGLE) - GetPrivateDnsZoneSuffixResponseInner execute(); + RecoverableServerResourceInner get(String resourceGroupName, String serverName); /** - * Get private DNS zone suffix in the cloud. + * Gets a recoverable MySQL 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 private DNS zone suffix in the cloud along with {@link Response}. + * @return a recoverable MySQL Server along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response executeWithResponse(Context context); + Response getWithResponse( + String resourceGroupName, String serverName, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ResourceProvidersClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..c0b134384f371 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ResourceProvidersClient.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryPerformanceInsightResetDataResultInner; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Reset data for Query Performance Insight. + * + * @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 result of Query Performance Insight data reset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryPerformanceInsightResetDataResultInner resetQueryPerformanceInsightData( + String resourceGroupName, String serverName); + + /** + * Reset data for Query Performance Insight. + * + * @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 result of Query Performance Insight data reset along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response resetQueryPerformanceInsightDataWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCreateRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCreateRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @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 createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerAdministratorsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerAdministratorsClient.java new file mode 100644 index 0000000000000..c726cb525445b --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerAdministratorsClient.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner; + +/** An instance of this class provides access to all the operations defined in ServerAdministratorsClient. */ +public interface ServerAdministratorsClient { + /** + * Gets information about a AAD server administrator. + * + * @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 information about a AAD server administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdministratorResourceInner get(String resourceGroupName, String serverName); + + /** + * Gets information about a AAD server administrator. + * + * @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 information about a AAD server administrator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerAdministratorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties); + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerAdministratorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context); + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @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 and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdministratorResourceInner createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties); + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @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 and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdministratorResourceInner createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context); + + /** + * Deletes server active directory administrator. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName); + + /** + * Deletes server active directory administrator. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, Context context); + + /** + * Deletes server active directory administrator. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName); + + /** + * Deletes server active directory administrator. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, Context context); + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName); + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerBasedPerformanceTiersClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerBasedPerformanceTiersClient.java new file mode 100644 index 0000000000000..5f6ce9bc125c2 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerBasedPerformanceTiersClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; + +/** An instance of this class provides access to all the operations defined in ServerBasedPerformanceTiersClient. */ +public interface ServerBasedPerformanceTiersClient { + /** + * List all the performance tiers for a MySQL 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 performance tiers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName); + + /** + * List all the performance tiers for a MySQL 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 performance tiers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerKeysClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerKeysClient.java new file mode 100644 index 0000000000000..3d3ca0a13c670 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerKeysClient.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerKeyInner; + +/** An instance of this class provides access to all the operations defined in ServerKeysClient. */ +public interface ServerKeysClient { + /** + * Gets a list of Server keys. + * + * @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 Server keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName); + + /** + * Gets a list of Server keys. + * + * @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 Server keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName, Context context); + + /** + * Gets a MySQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be retrieved. + * @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 MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner get(String resourceGroupName, String serverName, String keyName); + + /** + * Gets a MySQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be retrieved. + * @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 MySQL Server key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context); + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @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 a MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters); + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @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 a MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context); + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @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 MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner createOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters); + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @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 MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner createOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context); + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String serverName, String keyName, String resourceGroupName); + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String serverName, String keyName, String resourceGroupName, Context context); + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String serverName, String keyName, String resourceGroupName); + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String serverName, String keyName, String resourceGroupName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerParametersClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerParametersClient.java new file mode 100644 index 0000000000000..a4cc31c58504e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerParametersClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; + +/** An instance of this class provides access to all the operations defined in ServerParametersClient. */ +public interface ServerParametersClient { + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ConfigurationListResultInner> beginListUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value); + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ConfigurationListResultInner> beginListUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context); + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value); + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerSecurityAlertPoliciesClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerSecurityAlertPoliciesClient.java new file mode 100644 index 0000000000000..c57edc5a7a077 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServerSecurityAlertPoliciesClient.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.SecurityAlertPolicyName; + +/** An instance of this class provides access to all the operations defined in ServerSecurityAlertPoliciesClient. */ +public interface ServerSecurityAlertPoliciesClient { + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Get the server's threat detection policies. + * + * @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 server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Get the server's threat detection policies. + * + * @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 server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServersClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServersClient.java index f052de5a16e36..0e556793cf1c1 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServersClient.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/ServersClient.java @@ -12,8 +12,9 @@ import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerForUpdate; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerRestartParameter; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerForCreate; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerUpdateParameters; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerUpgradeParameters; /** An instance of this class provides access to all the operations defined in ServersClient. */ public interface ServersClient { @@ -30,7 +31,7 @@ public interface ServersClient { */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerInner> beginCreate( - String resourceGroupName, String serverName, ServerInner parameters); + String resourceGroupName, String serverName, ServerForCreate parameters); /** * Creates a new server or updates an existing server. The update action will overwrite the existing server. @@ -46,7 +47,7 @@ SyncPoller, ServerInner> beginCreate( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerInner> beginCreate( - String resourceGroupName, String serverName, ServerInner parameters, Context context); + String resourceGroupName, String serverName, ServerForCreate parameters, Context context); /** * Creates a new server or updates an existing server. The update action will overwrite the existing server. @@ -60,7 +61,7 @@ SyncPoller, ServerInner> beginCreate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner create(String resourceGroupName, String serverName, ServerInner parameters); + ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters); /** * Creates a new server or updates an existing server. The update action will overwrite the existing server. @@ -75,7 +76,7 @@ SyncPoller, ServerInner> beginCreate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner create(String resourceGroupName, String serverName, ServerInner parameters, Context context); + ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters, Context context); /** * Updates an existing server. The request body can contain one to many of the properties present in the normal @@ -91,7 +92,7 @@ SyncPoller, ServerInner> beginCreate( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerInner> beginUpdate( - String resourceGroupName, String serverName, ServerForUpdate parameters); + String resourceGroupName, String serverName, ServerUpdateParameters parameters); /** * Updates an existing server. The request body can contain one to many of the properties present in the normal @@ -108,7 +109,7 @@ SyncPoller, ServerInner> beginUpdate( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerInner> beginUpdate( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context); + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context); /** * Updates an existing server. The request body can contain one to many of the properties present in the normal @@ -123,7 +124,7 @@ SyncPoller, ServerInner> beginUpdate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner update(String resourceGroupName, String serverName, ServerForUpdate parameters); + ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters); /** * Updates an existing server. The request body can contain one to many of the properties present in the normal @@ -139,7 +140,7 @@ SyncPoller, ServerInner> beginUpdate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner update(String resourceGroupName, String serverName, ServerForUpdate parameters, Context context); + ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context); /** * Deletes a server. @@ -268,7 +269,7 @@ SyncPoller, ServerInner> beginUpdate( PagedIterable list(Context context); /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -278,10 +279,10 @@ SyncPoller, ServerInner> beginUpdate( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginFailover(String resourceGroupName, String serverName); + SyncPoller, Void> beginRestart(String resourceGroupName, String serverName); /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -292,10 +293,10 @@ SyncPoller, ServerInner> beginUpdate( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginFailover(String resourceGroupName, String serverName, Context context); + SyncPoller, Void> beginRestart(String resourceGroupName, String serverName, Context context); /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -304,10 +305,10 @@ SyncPoller, ServerInner> beginUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void failover(String resourceGroupName, String serverName); + void restart(String resourceGroupName, String serverName); /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -317,29 +318,26 @@ SyncPoller, ServerInner> beginUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void failover(String resourceGroupName, String serverName, Context context); + void restart(String resourceGroupName, String serverName, Context context); /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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 {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, ServerRestartParameter parameters); + SyncPoller, Void> beginStart(String resourceGroupName, String serverName); /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. @@ -347,38 +345,35 @@ SyncPoller, Void> beginRestart( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, ServerRestartParameter parameters, Context context); + SyncPoller, Void> beginStart(String resourceGroupName, String serverName, Context context); /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - void restart(String resourceGroupName, String serverName, ServerRestartParameter parameters); + void start(String resourceGroupName, String serverName); /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - void restart(String resourceGroupName, String serverName, ServerRestartParameter parameters, Context context); + void start(String resourceGroupName, String serverName, Context context); /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -388,10 +383,10 @@ SyncPoller, Void> beginRestart( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStart(String resourceGroupName, String serverName); + SyncPoller, Void> beginStop(String resourceGroupName, String serverName); /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -402,10 +397,10 @@ SyncPoller, Void> beginRestart( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStart(String resourceGroupName, String serverName, Context context); + SyncPoller, Void> beginStop(String resourceGroupName, String serverName, Context context); /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -414,10 +409,10 @@ SyncPoller, Void> beginRestart( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void start(String resourceGroupName, String serverName); + void stop(String resourceGroupName, String serverName); /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -427,26 +422,29 @@ SyncPoller, Void> beginRestart( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void start(String resourceGroupName, String serverName, Context context); + void stop(String resourceGroupName, String serverName, Context context); /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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 {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStop(String resourceGroupName, String serverName); + SyncPoller, Void> beginUpgrade( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters); /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. @@ -454,30 +452,33 @@ SyncPoller, Void> beginRestart( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStop(String resourceGroupName, String serverName, Context context); + SyncPoller, Void> beginUpgrade( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters, Context context); /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - void stop(String resourceGroupName, String serverName); + void upgrade(String resourceGroupName, String serverName, ServerUpgradeParameters parameters); /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - void stop(String resourceGroupName, String serverName, Context context); + void upgrade(String resourceGroupName, String serverName, ServerUpgradeParameters parameters, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/TopQueryStatisticsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/TopQueryStatisticsClient.java new file mode 100644 index 0000000000000..06d53be5bedc2 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/TopQueryStatisticsClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryStatisticInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.TopQueryStatisticsInput; + +/** An instance of this class provides access to all the operations defined in TopQueryStatisticsClient. */ +public interface TopQueryStatisticsClient { + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @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 Query Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryStatisticInner get(String resourceGroupName, String serverName, String queryStatisticId); + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @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 Query Statistic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String queryStatisticId, Context context); + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @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 query statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters); + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @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 query statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/VirtualNetworkRulesClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/VirtualNetworkRulesClient.java new file mode 100644 index 0000000000000..2a28efb08be8c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/VirtualNetworkRulesClient.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkRuleInner; + +/** An instance of this class provides access to all the operations defined in VirtualNetworkRulesClient. */ +public interface VirtualNetworkRulesClient { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Gets a list of virtual network rules in a 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 virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of virtual network rules in a 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 virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/WaitStatisticsClient.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/WaitStatisticsClient.java new file mode 100644 index 0000000000000..26b37f80db5c8 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/WaitStatisticsClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.WaitStatisticInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatisticsInput; + +/** An instance of this class provides access to all the operations defined in WaitStatisticsClient. */ +public interface WaitStatisticsClient { + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @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 Wait Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WaitStatisticInner get(String resourceGroupName, String serverName, String waitStatisticsId); + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @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 Wait Statistic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String waitStatisticsId, Context context); + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @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 wait statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters); + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @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 wait statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/AdvisorInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/AdvisorInner.java new file mode 100644 index 0000000000000..5044711ba8fa9 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/AdvisorInner.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.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a recommendation action advisor. */ +@Fluent +public final class AdvisorInner extends ProxyResource { + /* + * The properties of a recommendation action advisor. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the properties property: The properties of a recommendation action advisor. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of a recommendation action advisor. + * + * @param properties the properties value to set. + * @return the AdvisorInner object itself. + */ + public AdvisorInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/CapabilityPropertiesInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/CapabilityPropertiesInner.java deleted file mode 100644 index fc92e7825a568..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/CapabilityPropertiesInner.java +++ /dev/null @@ -1,85 +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.mysqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerEditionCapability; -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; - - /* - * supported geo backup regions - */ - @JsonProperty(value = "supportedGeoBackupRegions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedGeoBackupRegions; - - /* - * A list of supported flexible server editions. - */ - @JsonProperty(value = "supportedFlexibleServerEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedFlexibleServerEditions; - - /** - * 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 supportedGeoBackupRegions property: supported geo backup regions. - * - * @return the supportedGeoBackupRegions value. - */ - public List supportedGeoBackupRegions() { - return this.supportedGeoBackupRegions; - } - - /** - * Get the supportedFlexibleServerEditions property: A list of supported flexible server editions. - * - * @return the supportedFlexibleServerEditions value. - */ - public List supportedFlexibleServerEditions() { - return this.supportedFlexibleServerEditions; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedFlexibleServerEditions() != null) { - supportedFlexibleServerEditions().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationForBatchUpdateProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationForBatchUpdateProperties.java deleted file mode 100644 index 560c498e7dee4..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationForBatchUpdateProperties.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.mysqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The properties can be updated for a configuration. */ -@Fluent -public final class ConfigurationForBatchUpdateProperties { - /* - * Value of the configuration. - */ - @JsonProperty(value = "value") - private String value; - - /* - * Source of the configuration. - */ - @JsonProperty(value = "source") - private String source; - - /** - * Get the value property: Value of the configuration. - * - * @return the value value. - */ - public String value() { - return this.value; - } - - /** - * Set the value property: Value of the configuration. - * - * @param value the value value to set. - * @return the ConfigurationForBatchUpdateProperties object itself. - */ - public ConfigurationForBatchUpdateProperties withValue(String value) { - this.value = value; - return this; - } - - /** - * Get the source property: Source of the configuration. - * - * @return the source value. - */ - public String source() { - return this.source; - } - - /** - * Set the source property: Source of the configuration. - * - * @param source the source value to set. - * @return the ConfigurationForBatchUpdateProperties object itself. - */ - public ConfigurationForBatchUpdateProperties withSource(String source) { - this.source = source; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationInner.java index b2bae1b3d5948..fb5b716305dbb 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationInner.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationInner.java @@ -6,11 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationSource; -import com.azure.resourcemanager.mysqlflexibleserver.models.IsConfigPendingRestart; -import com.azure.resourcemanager.mysqlflexibleserver.models.IsDynamicConfig; -import com.azure.resourcemanager.mysqlflexibleserver.models.IsReadOnly; import com.fasterxml.jackson.annotation.JsonProperty; /** Represents a Configuration. */ @@ -22,12 +17,6 @@ public final class ConfigurationInner extends ProxyResource { @JsonProperty(value = "properties") private ConfigurationProperties innerProperties; - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /** * Get the innerProperties property: The properties of a configuration. * @@ -37,15 +26,6 @@ private ConfigurationProperties innerProperties() { return this.innerProperties; } - /** - * Get the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the value property: Value of the configuration. * @@ -110,7 +90,7 @@ public String allowedValues() { * * @return the source value. */ - public ConfigurationSource source() { + public String source() { return this.innerProperties() == null ? null : this.innerProperties().source(); } @@ -120,7 +100,7 @@ public ConfigurationSource source() { * @param source the source value to set. * @return the ConfigurationInner object itself. */ - public ConfigurationInner withSource(ConfigurationSource source) { + public ConfigurationInner withSource(String source) { if (this.innerProperties() == null) { this.innerProperties = new ConfigurationProperties(); } @@ -128,33 +108,6 @@ public ConfigurationInner withSource(ConfigurationSource source) { return this; } - /** - * Get the isReadOnly property: If is the configuration read only. - * - * @return the isReadOnly value. - */ - public IsReadOnly isReadOnly() { - return this.innerProperties() == null ? null : this.innerProperties().isReadOnly(); - } - - /** - * Get the isConfigPendingRestart property: If is the configuration pending restart or not. - * - * @return the isConfigPendingRestart value. - */ - public IsConfigPendingRestart isConfigPendingRestart() { - return this.innerProperties() == null ? null : this.innerProperties().isConfigPendingRestart(); - } - - /** - * Get the isDynamicConfig property: If is the configuration dynamic. - * - * @return the isDynamicConfig value. - */ - public IsDynamicConfig isDynamicConfig() { - return this.innerProperties() == null ? null : this.innerProperties().isDynamicConfig(); - } - /** * Validates the instance. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationListResultInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationListResultInner.java index 91a3ffdabd153..02bba4c1ac03f 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationListResultInner.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationListResultInner.java @@ -17,12 +17,6 @@ public final class ConfigurationListResultInner { @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - /** * Get the value property: The list of server configurations. * @@ -43,26 +37,6 @@ public ConfigurationListResultInner withValue(List 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 ConfigurationListResultInner object itself. - */ - public ConfigurationListResultInner withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationProperties.java index b14cf78fbe34a..085c70977f53e 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationProperties.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ConfigurationProperties.java @@ -5,10 +5,6 @@ package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationSource; -import com.azure.resourcemanager.mysqlflexibleserver.models.IsConfigPendingRestart; -import com.azure.resourcemanager.mysqlflexibleserver.models.IsDynamicConfig; -import com.azure.resourcemanager.mysqlflexibleserver.models.IsReadOnly; import com.fasterxml.jackson.annotation.JsonProperty; /** The properties of a configuration. */ @@ -48,25 +44,7 @@ public final class ConfigurationProperties { * Source of the configuration. */ @JsonProperty(value = "source") - private ConfigurationSource source; - - /* - * If is the configuration read only. - */ - @JsonProperty(value = "isReadOnly", access = JsonProperty.Access.WRITE_ONLY) - private IsReadOnly isReadOnly; - - /* - * If is the configuration pending restart or not. - */ - @JsonProperty(value = "isConfigPendingRestart", access = JsonProperty.Access.WRITE_ONLY) - private IsConfigPendingRestart isConfigPendingRestart; - - /* - * If is the configuration dynamic. - */ - @JsonProperty(value = "isDynamicConfig", access = JsonProperty.Access.WRITE_ONLY) - private IsDynamicConfig isDynamicConfig; + private String source; /** * Get the value property: Value of the configuration. @@ -129,7 +107,7 @@ public String allowedValues() { * * @return the source value. */ - public ConfigurationSource source() { + public String source() { return this.source; } @@ -139,38 +117,11 @@ public ConfigurationSource source() { * @param source the source value to set. * @return the ConfigurationProperties object itself. */ - public ConfigurationProperties withSource(ConfigurationSource source) { + public ConfigurationProperties withSource(String source) { this.source = source; return this; } - /** - * Get the isReadOnly property: If is the configuration read only. - * - * @return the isReadOnly value. - */ - public IsReadOnly isReadOnly() { - return this.isReadOnly; - } - - /** - * Get the isConfigPendingRestart property: If is the configuration pending restart or not. - * - * @return the isConfigPendingRestart value. - */ - public IsConfigPendingRestart isConfigPendingRestart() { - return this.isConfigPendingRestart; - } - - /** - * Get the isDynamicConfig property: If is the configuration dynamic. - * - * @return the isDynamicConfig value. - */ - public IsDynamicConfig isDynamicConfig() { - return this.isDynamicConfig; - } - /** * Validates the instance. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/DatabaseInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/DatabaseInner.java index 84fa277b59537..14e3839c6b3fb 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/DatabaseInner.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/DatabaseInner.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; import com.fasterxml.jackson.annotation.JsonProperty; /** Represents a Database. */ @@ -18,12 +17,6 @@ public final class DatabaseInner extends ProxyResource { @JsonProperty(value = "properties") private DatabaseProperties innerProperties; - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /** * Get the innerProperties property: The properties of a database. * @@ -33,15 +26,6 @@ private DatabaseProperties innerProperties() { return this.innerProperties; } - /** - * Get the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the charset property: The charset of the database. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/FirewallRuleInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/FirewallRuleInner.java index 383d94fbe9500..8900ee70ffbe1 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/FirewallRuleInner.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/FirewallRuleInner.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonProperty; @@ -19,12 +18,6 @@ public final class FirewallRuleInner extends ProxyResource { @JsonProperty(value = "properties", required = true) private FirewallRuleProperties innerProperties = new FirewallRuleProperties(); - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /** * Get the innerProperties property: The properties of a firewall rule. * @@ -34,15 +27,6 @@ private FirewallRuleProperties innerProperties() { return this.innerProperties; } - /** - * Get the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/GetPrivateDnsZoneSuffixResponseInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/GetPrivateDnsZoneSuffixResponseInner.java deleted file mode 100644 index 1467d1aae6ff4..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/GetPrivateDnsZoneSuffixResponseInner.java +++ /dev/null @@ -1,46 +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.mysqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The response of get private dns zone suffix. */ -@Fluent -public final class GetPrivateDnsZoneSuffixResponseInner { - /* - * Represents the private DNS zone suffix. - */ - @JsonProperty(value = "privateDnsZoneSuffix") - private String privateDnsZoneSuffix; - - /** - * Get the privateDnsZoneSuffix property: Represents the private DNS zone suffix. - * - * @return the privateDnsZoneSuffix value. - */ - public String privateDnsZoneSuffix() { - return this.privateDnsZoneSuffix; - } - - /** - * Set the privateDnsZoneSuffix property: Represents the private DNS zone suffix. - * - * @param privateDnsZoneSuffix the privateDnsZoneSuffix value to set. - * @return the GetPrivateDnsZoneSuffixResponseInner object itself. - */ - public GetPrivateDnsZoneSuffixResponseInner withPrivateDnsZoneSuffix(String privateDnsZoneSuffix) { - this.privateDnsZoneSuffix = privateDnsZoneSuffix; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/LogFileInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/LogFileInner.java new file mode 100644 index 0000000000000..5ae070c038ee7 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/LogFileInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a log file. */ +@Fluent +public final class LogFileInner extends ProxyResource { + /* + * The properties of the log file. + */ + @JsonProperty(value = "properties") + private LogFileProperties innerProperties; + + /** + * Get the innerProperties property: The properties of the log file. + * + * @return the innerProperties value. + */ + private LogFileProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sizeInKB property: Size of the log file. + * + * @return the sizeInKB value. + */ + public Long sizeInKB() { + return this.innerProperties() == null ? null : this.innerProperties().sizeInKB(); + } + + /** + * Set the sizeInKB property: Size of the log file. + * + * @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 createdTime property: Creation timestamp of the log file. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.innerProperties() == null ? null : this.innerProperties().createdTime(); + } + + /** + * 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(); + } + + /** + * 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/LogFileProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/LogFileProperties.java new file mode 100644 index 0000000000000..74e5abe70eee4 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/LogFileProperties.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a log file. */ +@Fluent +public final class LogFileProperties { + /* + * Size of the log file. + */ + @JsonProperty(value = "sizeInKB") + private Long sizeInKB; + + /* + * Creation timestamp of the log file. + */ + @JsonProperty(value = "createdTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdTime; + + /* + * Last modified timestamp of the log file. + */ + @JsonProperty(value = "lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedTime; + + /* + * 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; + + /** + * Get the sizeInKB property: Size of the log file. + * + * @return the sizeInKB value. + */ + public Long sizeInKB() { + return this.sizeInKB; + } + + /** + * Set the sizeInKB property: Size of the log file. + * + * @param sizeInKB the sizeInKB value to set. + * @return the LogFileProperties object itself. + */ + public LogFileProperties withSizeInKB(Long sizeInKB) { + this.sizeInKB = sizeInKB; + return this; + } + + /** + * Get the createdTime property: Creation timestamp of the log file. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Get the lastModifiedTime property: Last modified timestamp of the log file. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/OperationInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/OperationInner.java deleted file mode 100644 index 9530971937b93..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/OperationInner.java +++ /dev/null @@ -1,132 +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.mysqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.mysqlflexibleserver.models.OperationDisplay; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Map; - -/** REST API operation definition. */ -@Fluent -public final class OperationInner { - /* - * The name of the operation being performed on this particular object. - */ - @JsonProperty(value = "name") - private String name; - - /* - * The localized display information for this particular operation or - * action. - */ - @JsonProperty(value = "display") - private OperationDisplay display; - - /* - * The intended executor of the operation. - */ - @JsonProperty(value = "origin") - private String origin; - - /* - * Additional descriptions for the operation. - */ - @JsonProperty(value = "properties") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) - private Map properties; - - /** - * Get the name property: The name of the operation being performed on this particular object. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name of the operation being performed on this particular object. - * - * @param name the name value to set. - * @return the OperationInner object itself. - */ - public OperationInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the display property: The localized display information for this particular operation or action. - * - * @return the display value. - */ - public OperationDisplay display() { - return this.display; - } - - /** - * Set the display property: The localized display information for this particular operation or action. - * - * @param display the display value to set. - * @return the OperationInner object itself. - */ - public OperationInner withDisplay(OperationDisplay display) { - this.display = display; - return this; - } - - /** - * Get the origin property: The intended executor of the operation. - * - * @return the origin value. - */ - public String origin() { - return this.origin; - } - - /** - * Set the origin property: The intended executor of the operation. - * - * @param origin the origin value to set. - * @return the OperationInner object itself. - */ - public OperationInner withOrigin(String origin) { - this.origin = origin; - return this; - } - - /** - * Get the properties property: Additional descriptions for the operation. - * - * @return the properties value. - */ - public Map properties() { - return this.properties; - } - - /** - * Set the properties property: Additional descriptions for the operation. - * - * @param properties the properties value to set. - * @return the OperationInner object itself. - */ - public OperationInner withProperties(Map properties) { - this.properties = properties; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (display() != null) { - display().validate(); - } - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/OperationListResultInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/OperationListResultInner.java new file mode 100644 index 0000000000000..4ee32c295f2d1 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/OperationListResultInner.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.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mysqlflexibleserver.models.Operation; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of resource provider operations. */ +@Fluent +public final class OperationListResultInner { + /* + * The list of resource provider operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of resource provider operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of resource provider operations. + * + * @param value the value value to set. + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withValue(List value) { + this.value = value; + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PerformanceTierPropertiesInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PerformanceTierPropertiesInner.java new file mode 100644 index 0000000000000..4ce1f2883f4bd --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PerformanceTierPropertiesInner.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mysqlflexibleserver.models.PerformanceTierServiceLevelObjectives; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Performance tier properties. */ +@Fluent +public final class PerformanceTierPropertiesInner { + /* + * ID of the performance tier. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Maximum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "maxBackupRetentionDays") + private Integer maxBackupRetentionDays; + + /* + * Minimum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "minBackupRetentionDays") + private Integer minBackupRetentionDays; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxStorageMB") + private Integer maxStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "minLargeStorageMB") + private Integer minLargeStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxLargeStorageMB") + private Integer maxLargeStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "minStorageMB") + private Integer minStorageMB; + + /* + * Service level objectives associated with the performance tier + */ + @JsonProperty(value = "serviceLevelObjectives") + private List serviceLevelObjectives; + + /** + * Get the id property: ID of the performance tier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: ID of the performance tier. + * + * @param id the id value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @return the maxBackupRetentionDays value. + */ + public Integer maxBackupRetentionDays() { + return this.maxBackupRetentionDays; + } + + /** + * Set the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @param maxBackupRetentionDays the maxBackupRetentionDays value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMaxBackupRetentionDays(Integer maxBackupRetentionDays) { + this.maxBackupRetentionDays = maxBackupRetentionDays; + return this; + } + + /** + * Get the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @return the minBackupRetentionDays value. + */ + public Integer minBackupRetentionDays() { + return this.minBackupRetentionDays; + } + + /** + * Set the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @param minBackupRetentionDays the minBackupRetentionDays value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMinBackupRetentionDays(Integer minBackupRetentionDays) { + this.minBackupRetentionDays = minBackupRetentionDays; + return this; + } + + /** + * Get the maxStorageMB property: Max storage allowed for a server. + * + * @return the maxStorageMB value. + */ + public Integer maxStorageMB() { + return this.maxStorageMB; + } + + /** + * Set the maxStorageMB property: Max storage allowed for a server. + * + * @param maxStorageMB the maxStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMaxStorageMB(Integer maxStorageMB) { + this.maxStorageMB = maxStorageMB; + return this; + } + + /** + * Get the minLargeStorageMB property: Max storage allowed for a server. + * + * @return the minLargeStorageMB value. + */ + public Integer minLargeStorageMB() { + return this.minLargeStorageMB; + } + + /** + * Set the minLargeStorageMB property: Max storage allowed for a server. + * + * @param minLargeStorageMB the minLargeStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMinLargeStorageMB(Integer minLargeStorageMB) { + this.minLargeStorageMB = minLargeStorageMB; + return this; + } + + /** + * Get the maxLargeStorageMB property: Max storage allowed for a server. + * + * @return the maxLargeStorageMB value. + */ + public Integer maxLargeStorageMB() { + return this.maxLargeStorageMB; + } + + /** + * Set the maxLargeStorageMB property: Max storage allowed for a server. + * + * @param maxLargeStorageMB the maxLargeStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMaxLargeStorageMB(Integer maxLargeStorageMB) { + this.maxLargeStorageMB = maxLargeStorageMB; + return this; + } + + /** + * Get the minStorageMB property: Max storage allowed for a server. + * + * @return the minStorageMB value. + */ + public Integer minStorageMB() { + return this.minStorageMB; + } + + /** + * Set the minStorageMB property: Max storage allowed for a server. + * + * @param minStorageMB the minStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMinStorageMB(Integer minStorageMB) { + this.minStorageMB = minStorageMB; + return this; + } + + /** + * Get the serviceLevelObjectives property: Service level objectives associated with the performance tier. + * + * @return the serviceLevelObjectives value. + */ + public List serviceLevelObjectives() { + return this.serviceLevelObjectives; + } + + /** + * Set the serviceLevelObjectives property: Service level objectives associated with the performance tier. + * + * @param serviceLevelObjectives the serviceLevelObjectives value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withServiceLevelObjectives( + List serviceLevelObjectives) { + this.serviceLevelObjectives = serviceLevelObjectives; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceLevelObjectives() != null) { + serviceLevelObjectives().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PrivateEndpointConnectionInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..50e1af985eca0 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointProperty; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..bef5520b29538 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointProperty; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PrivateLinkResourceInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..1d2a7cad99c69 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private link resource. */ +@Immutable +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * The private link resource group id. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkResourceProperties properties; + + /** + * Get the properties property: The private link resource group id. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryPerformanceInsightResetDataResultInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryPerformanceInsightResetDataResultInner.java new file mode 100644 index 0000000000000..150df459ae79c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryPerformanceInsightResetDataResultInner.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryPerformanceInsightResetDataResultState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Result of Query Performance Insight data reset. */ +@Fluent +public final class QueryPerformanceInsightResetDataResultInner { + /* + * Indicates result of the operation. + */ + @JsonProperty(value = "status") + private QueryPerformanceInsightResetDataResultState status; + + /* + * operation message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the status property: Indicates result of the operation. + * + * @return the status value. + */ + public QueryPerformanceInsightResetDataResultState status() { + return this.status; + } + + /** + * Set the status property: Indicates result of the operation. + * + * @param status the status value to set. + * @return the QueryPerformanceInsightResetDataResultInner object itself. + */ + public QueryPerformanceInsightResetDataResultInner withStatus(QueryPerformanceInsightResetDataResultState status) { + this.status = status; + return this; + } + + /** + * Get the message property: operation message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: operation message. + * + * @param message the message value to set. + * @return the QueryPerformanceInsightResetDataResultInner object itself. + */ + public QueryPerformanceInsightResetDataResultInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryStatisticInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryStatisticInner.java new file mode 100644 index 0000000000000..844b938eedc75 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryStatisticInner.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Represents a Query Statistic. */ +@Fluent +public final class QueryStatisticInner extends ProxyResource { + /* + * The properties of a query statistic. + */ + @JsonProperty(value = "properties") + private QueryStatisticProperties innerProperties; + + /** + * Get the innerProperties property: The properties of a query statistic. + * + * @return the innerProperties value. + */ + private QueryStatisticProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the queryId property: Database query identifier. + * + * @return the queryId value. + */ + public String queryId() { + return this.innerProperties() == null ? null : this.innerProperties().queryId(); + } + + /** + * Set the queryId property: Database query identifier. + * + * @param queryId the queryId value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withQueryId(String queryId) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withQueryId(queryId); + return this; + } + + /** + * Get the startTime property: Observation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Set the startTime property: Observation start time. + * + * @param startTime the startTime value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withStartTime(OffsetDateTime startTime) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withStartTime(startTime); + return this; + } + + /** + * Get the endTime property: Observation end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Set the endTime property: Observation end time. + * + * @param endTime the endTime value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withEndTime(OffsetDateTime endTime) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withEndTime(endTime); + return this; + } + + /** + * Get the aggregationFunction property: Aggregation function name. + * + * @return the aggregationFunction value. + */ + public String aggregationFunction() { + return this.innerProperties() == null ? null : this.innerProperties().aggregationFunction(); + } + + /** + * Set the aggregationFunction property: Aggregation function name. + * + * @param aggregationFunction the aggregationFunction value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withAggregationFunction(String aggregationFunction) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withAggregationFunction(aggregationFunction); + return this; + } + + /** + * Get the databaseNames property: The list of database names. + * + * @return the databaseNames value. + */ + public List databaseNames() { + return this.innerProperties() == null ? null : this.innerProperties().databaseNames(); + } + + /** + * Set the databaseNames property: The list of database names. + * + * @param databaseNames the databaseNames value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withDatabaseNames(List databaseNames) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withDatabaseNames(databaseNames); + return this; + } + + /** + * Get the queryExecutionCount property: Number of query executions in this time interval. + * + * @return the queryExecutionCount value. + */ + public Long queryExecutionCount() { + return this.innerProperties() == null ? null : this.innerProperties().queryExecutionCount(); + } + + /** + * Set the queryExecutionCount property: Number of query executions in this time interval. + * + * @param queryExecutionCount the queryExecutionCount value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withQueryExecutionCount(Long queryExecutionCount) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withQueryExecutionCount(queryExecutionCount); + return this; + } + + /** + * Get the metricName property: Metric name. + * + * @return the metricName value. + */ + public String metricName() { + return this.innerProperties() == null ? null : this.innerProperties().metricName(); + } + + /** + * Set the metricName property: Metric name. + * + * @param metricName the metricName value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withMetricName(String metricName) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withMetricName(metricName); + return this; + } + + /** + * Get the metricDisplayName property: Metric display name. + * + * @return the metricDisplayName value. + */ + public String metricDisplayName() { + return this.innerProperties() == null ? null : this.innerProperties().metricDisplayName(); + } + + /** + * Set the metricDisplayName property: Metric display name. + * + * @param metricDisplayName the metricDisplayName value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withMetricDisplayName(String metricDisplayName) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withMetricDisplayName(metricDisplayName); + return this; + } + + /** + * Get the metricValue property: Metric value. + * + * @return the metricValue value. + */ + public Double metricValue() { + return this.innerProperties() == null ? null : this.innerProperties().metricValue(); + } + + /** + * Set the metricValue property: Metric value. + * + * @param metricValue the metricValue value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withMetricValue(Double metricValue) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withMetricValue(metricValue); + return this; + } + + /** + * Get the metricValueUnit property: Metric value unit. + * + * @return the metricValueUnit value. + */ + public String metricValueUnit() { + return this.innerProperties() == null ? null : this.innerProperties().metricValueUnit(); + } + + /** + * Set the metricValueUnit property: Metric value unit. + * + * @param metricValueUnit the metricValueUnit value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withMetricValueUnit(String metricValueUnit) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticProperties(); + } + this.innerProperties().withMetricValueUnit(metricValueUnit); + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryStatisticProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryStatisticProperties.java new file mode 100644 index 0000000000000..539fffbfcaa10 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryStatisticProperties.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.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The properties of a query statistic. */ +@Fluent +public final class QueryStatisticProperties { + /* + * Database query identifier. + */ + @JsonProperty(value = "queryId") + private String queryId; + + /* + * Observation start time. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Observation end time. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * Aggregation function name. + */ + @JsonProperty(value = "aggregationFunction") + private String aggregationFunction; + + /* + * The list of database names. + */ + @JsonProperty(value = "databaseNames") + private List databaseNames; + + /* + * Number of query executions in this time interval. + */ + @JsonProperty(value = "queryExecutionCount") + private Long queryExecutionCount; + + /* + * Metric name. + */ + @JsonProperty(value = "metricName") + private String metricName; + + /* + * Metric display name. + */ + @JsonProperty(value = "metricDisplayName") + private String metricDisplayName; + + /* + * Metric value. + */ + @JsonProperty(value = "metricValue") + private Double metricValue; + + /* + * Metric value unit. + */ + @JsonProperty(value = "metricValueUnit") + private String metricValueUnit; + + /** + * Get the queryId property: Database query identifier. + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Set the queryId property: Database query identifier. + * + * @param queryId the queryId value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withQueryId(String queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the startTime property: Observation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Observation start time. + * + * @param startTime the startTime value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Observation end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Observation end time. + * + * @param endTime the endTime value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the aggregationFunction property: Aggregation function name. + * + * @return the aggregationFunction value. + */ + public String aggregationFunction() { + return this.aggregationFunction; + } + + /** + * Set the aggregationFunction property: Aggregation function name. + * + * @param aggregationFunction the aggregationFunction value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withAggregationFunction(String aggregationFunction) { + this.aggregationFunction = aggregationFunction; + return this; + } + + /** + * Get the databaseNames property: The list of database names. + * + * @return the databaseNames value. + */ + public List databaseNames() { + return this.databaseNames; + } + + /** + * Set the databaseNames property: The list of database names. + * + * @param databaseNames the databaseNames value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withDatabaseNames(List databaseNames) { + this.databaseNames = databaseNames; + return this; + } + + /** + * Get the queryExecutionCount property: Number of query executions in this time interval. + * + * @return the queryExecutionCount value. + */ + public Long queryExecutionCount() { + return this.queryExecutionCount; + } + + /** + * Set the queryExecutionCount property: Number of query executions in this time interval. + * + * @param queryExecutionCount the queryExecutionCount value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withQueryExecutionCount(Long queryExecutionCount) { + this.queryExecutionCount = queryExecutionCount; + return this; + } + + /** + * Get the metricName property: Metric name. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: Metric name. + * + * @param metricName the metricName value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the metricDisplayName property: Metric display name. + * + * @return the metricDisplayName value. + */ + public String metricDisplayName() { + return this.metricDisplayName; + } + + /** + * Set the metricDisplayName property: Metric display name. + * + * @param metricDisplayName the metricDisplayName value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withMetricDisplayName(String metricDisplayName) { + this.metricDisplayName = metricDisplayName; + return this; + } + + /** + * Get the metricValue property: Metric value. + * + * @return the metricValue value. + */ + public Double metricValue() { + return this.metricValue; + } + + /** + * Set the metricValue property: Metric value. + * + * @param metricValue the metricValue value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withMetricValue(Double metricValue) { + this.metricValue = metricValue; + return this; + } + + /** + * Get the metricValueUnit property: Metric value unit. + * + * @return the metricValueUnit value. + */ + public String metricValueUnit() { + return this.metricValueUnit; + } + + /** + * Set the metricValueUnit property: Metric value unit. + * + * @param metricValueUnit the metricValueUnit value to set. + * @return the QueryStatisticProperties object itself. + */ + public QueryStatisticProperties withMetricValueUnit(String metricValueUnit) { + this.metricValueUnit = metricValueUnit; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryTextInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryTextInner.java new file mode 100644 index 0000000000000..ad50297514549 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryTextInner.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a Query Text. */ +@Fluent +public final class QueryTextInner extends ProxyResource { + /* + * The properties of a query text. + */ + @JsonProperty(value = "properties") + private QueryTextProperties innerProperties; + + /** + * Get the innerProperties property: The properties of a query text. + * + * @return the innerProperties value. + */ + private QueryTextProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the queryId property: Query identifier unique to the server. + * + * @return the queryId value. + */ + public String queryId() { + return this.innerProperties() == null ? null : this.innerProperties().queryId(); + } + + /** + * Set the queryId property: Query identifier unique to the server. + * + * @param queryId the queryId value to set. + * @return the QueryTextInner object itself. + */ + public QueryTextInner withQueryId(String queryId) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryTextProperties(); + } + this.innerProperties().withQueryId(queryId); + return this; + } + + /** + * Get the queryText property: Query text. + * + * @return the queryText value. + */ + public String queryText() { + return this.innerProperties() == null ? null : this.innerProperties().queryText(); + } + + /** + * Set the queryText property: Query text. + * + * @param queryText the queryText value to set. + * @return the QueryTextInner object itself. + */ + public QueryTextInner withQueryText(String queryText) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryTextProperties(); + } + this.innerProperties().withQueryText(queryText); + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryTextProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryTextProperties.java new file mode 100644 index 0000000000000..3388700b48bf2 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/QueryTextProperties.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.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a query text. */ +@Fluent +public final class QueryTextProperties { + /* + * Query identifier unique to the server. + */ + @JsonProperty(value = "queryId") + private String queryId; + + /* + * Query text. + */ + @JsonProperty(value = "queryText") + private String queryText; + + /** + * Get the queryId property: Query identifier unique to the server. + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Set the queryId property: Query identifier unique to the server. + * + * @param queryId the queryId value to set. + * @return the QueryTextProperties object itself. + */ + public QueryTextProperties withQueryId(String queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the queryText property: Query text. + * + * @return the queryText value. + */ + public String queryText() { + return this.queryText; + } + + /** + * Set the queryText property: Query text. + * + * @param queryText the queryText value to set. + * @return the QueryTextProperties object itself. + */ + public QueryTextProperties withQueryText(String queryText) { + this.queryText = queryText; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecommendationActionInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecommendationActionInner.java new file mode 100644 index 0000000000000..b1a3c1561c577 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecommendationActionInner.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Represents a Recommendation Action. */ +@Fluent +public final class RecommendationActionInner extends ProxyResource { + /* + * The properties of a recommendation action. + */ + @JsonProperty(value = "properties") + private RecommendationActionProperties innerProperties; + + /** + * Get the innerProperties property: The properties of a recommendation action. + * + * @return the innerProperties value. + */ + private RecommendationActionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the advisorName property: Advisor name. + * + * @return the advisorName value. + */ + public String advisorName() { + return this.innerProperties() == null ? null : this.innerProperties().advisorName(); + } + + /** + * Set the advisorName property: Advisor name. + * + * @param advisorName the advisorName value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withAdvisorName(String advisorName) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationActionProperties(); + } + this.innerProperties().withAdvisorName(advisorName); + return this; + } + + /** + * Get the sessionId property: Recommendation action session identifier. + * + * @return the sessionId value. + */ + public String sessionId() { + return this.innerProperties() == null ? null : this.innerProperties().sessionId(); + } + + /** + * Set the sessionId property: Recommendation action session identifier. + * + * @param sessionId the sessionId value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withSessionId(String sessionId) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationActionProperties(); + } + this.innerProperties().withSessionId(sessionId); + return this; + } + + /** + * Get the actionId property: Recommendation action identifier. + * + * @return the actionId value. + */ + public Integer actionId() { + return this.innerProperties() == null ? null : this.innerProperties().actionId(); + } + + /** + * Set the actionId property: Recommendation action identifier. + * + * @param actionId the actionId value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withActionId(Integer actionId) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationActionProperties(); + } + this.innerProperties().withActionId(actionId); + return this; + } + + /** + * Get the createdTime property: Recommendation action creation time. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.innerProperties() == null ? null : this.innerProperties().createdTime(); + } + + /** + * Set the createdTime property: Recommendation action creation time. + * + * @param createdTime the createdTime value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withCreatedTime(OffsetDateTime createdTime) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationActionProperties(); + } + this.innerProperties().withCreatedTime(createdTime); + return this; + } + + /** + * Get the expirationTime property: Recommendation action expiration time. + * + * @return the expirationTime value. + */ + public OffsetDateTime expirationTime() { + return this.innerProperties() == null ? null : this.innerProperties().expirationTime(); + } + + /** + * Set the expirationTime property: Recommendation action expiration time. + * + * @param expirationTime the expirationTime value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withExpirationTime(OffsetDateTime expirationTime) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationActionProperties(); + } + this.innerProperties().withExpirationTime(expirationTime); + return this; + } + + /** + * Get the reason property: Recommendation action reason. + * + * @return the reason value. + */ + public String reason() { + return this.innerProperties() == null ? null : this.innerProperties().reason(); + } + + /** + * Set the reason property: Recommendation action reason. + * + * @param reason the reason value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withReason(String reason) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationActionProperties(); + } + this.innerProperties().withReason(reason); + return this; + } + + /** + * Get the recommendationType property: Recommendation action type. + * + * @return the recommendationType value. + */ + public String recommendationType() { + return this.innerProperties() == null ? null : this.innerProperties().recommendationType(); + } + + /** + * Set the recommendationType property: Recommendation action type. + * + * @param recommendationType the recommendationType value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withRecommendationType(String recommendationType) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationActionProperties(); + } + this.innerProperties().withRecommendationType(recommendationType); + return this; + } + + /** + * Get the details property: Recommendation action details. + * + * @return the details value. + */ + public Map details() { + return this.innerProperties() == null ? null : this.innerProperties().details(); + } + + /** + * Set the details property: Recommendation action details. + * + * @param details the details value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withDetails(Map details) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationActionProperties(); + } + this.innerProperties().withDetails(details); + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecommendationActionProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecommendationActionProperties.java new file mode 100644 index 0000000000000..45731d63a9b4d --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecommendationActionProperties.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** The properties of a recommendation action. */ +@Fluent +public final class RecommendationActionProperties { + /* + * Advisor name. + */ + @JsonProperty(value = "advisorName") + private String advisorName; + + /* + * Recommendation action session identifier. + */ + @JsonProperty(value = "sessionId") + private String sessionId; + + /* + * Recommendation action identifier. + */ + @JsonProperty(value = "actionId") + private Integer actionId; + + /* + * Recommendation action creation time. + */ + @JsonProperty(value = "createdTime") + private OffsetDateTime createdTime; + + /* + * Recommendation action expiration time. + */ + @JsonProperty(value = "expirationTime") + private OffsetDateTime expirationTime; + + /* + * Recommendation action reason. + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * Recommendation action type. + */ + @JsonProperty(value = "recommendationType") + private String recommendationType; + + /* + * Recommendation action details. + */ + @JsonProperty(value = "details") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map details; + + /** + * Get the advisorName property: Advisor name. + * + * @return the advisorName value. + */ + public String advisorName() { + return this.advisorName; + } + + /** + * Set the advisorName property: Advisor name. + * + * @param advisorName the advisorName value to set. + * @return the RecommendationActionProperties object itself. + */ + public RecommendationActionProperties withAdvisorName(String advisorName) { + this.advisorName = advisorName; + return this; + } + + /** + * Get the sessionId property: Recommendation action session identifier. + * + * @return the sessionId value. + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: Recommendation action session identifier. + * + * @param sessionId the sessionId value to set. + * @return the RecommendationActionProperties object itself. + */ + public RecommendationActionProperties withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the actionId property: Recommendation action identifier. + * + * @return the actionId value. + */ + public Integer actionId() { + return this.actionId; + } + + /** + * Set the actionId property: Recommendation action identifier. + * + * @param actionId the actionId value to set. + * @return the RecommendationActionProperties object itself. + */ + public RecommendationActionProperties withActionId(Integer actionId) { + this.actionId = actionId; + return this; + } + + /** + * Get the createdTime property: Recommendation action creation time. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Set the createdTime property: Recommendation action creation time. + * + * @param createdTime the createdTime value to set. + * @return the RecommendationActionProperties object itself. + */ + public RecommendationActionProperties withCreatedTime(OffsetDateTime createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get the expirationTime property: Recommendation action expiration time. + * + * @return the expirationTime value. + */ + public OffsetDateTime expirationTime() { + return this.expirationTime; + } + + /** + * Set the expirationTime property: Recommendation action expiration time. + * + * @param expirationTime the expirationTime value to set. + * @return the RecommendationActionProperties object itself. + */ + public RecommendationActionProperties withExpirationTime(OffsetDateTime expirationTime) { + this.expirationTime = expirationTime; + return this; + } + + /** + * Get the reason property: Recommendation action reason. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Recommendation action reason. + * + * @param reason the reason value to set. + * @return the RecommendationActionProperties object itself. + */ + public RecommendationActionProperties withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the recommendationType property: Recommendation action type. + * + * @return the recommendationType value. + */ + public String recommendationType() { + return this.recommendationType; + } + + /** + * Set the recommendationType property: Recommendation action type. + * + * @param recommendationType the recommendationType value to set. + * @return the RecommendationActionProperties object itself. + */ + public RecommendationActionProperties withRecommendationType(String recommendationType) { + this.recommendationType = recommendationType; + return this; + } + + /** + * Get the details property: Recommendation action details. + * + * @return the details value. + */ + public Map details() { + return this.details; + } + + /** + * Set the details property: Recommendation action details. + * + * @param details the details value to set. + * @return the RecommendationActionProperties object itself. + */ + public RecommendationActionProperties withDetails(Map details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecommendedActionSessionsOperationStatusInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecommendedActionSessionsOperationStatusInner.java new file mode 100644 index 0000000000000..47ced56df4766 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecommendedActionSessionsOperationStatusInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Recommendation action session operation status. */ +@Fluent +public final class RecommendedActionSessionsOperationStatusInner { + /* + * Operation identifier. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Operation start time. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Operation status. + */ + @JsonProperty(value = "status") + private String status; + + /** + * Get the name property: Operation identifier. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation identifier. + * + * @param name the name value to set. + * @return the RecommendedActionSessionsOperationStatusInner object itself. + */ + public RecommendedActionSessionsOperationStatusInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the startTime property: Operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Operation start time. + * + * @param startTime the startTime value to set. + * @return the RecommendedActionSessionsOperationStatusInner object itself. + */ + public RecommendedActionSessionsOperationStatusInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Operation status. + * + * @param status the status value to set. + * @return the RecommendedActionSessionsOperationStatusInner object itself. + */ + public RecommendedActionSessionsOperationStatusInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecoverableServerProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecoverableServerProperties.java new file mode 100644 index 0000000000000..26c84d4c20adc --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecoverableServerProperties.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The recoverable server's properties. */ +@Immutable +public final class RecoverableServerProperties { + /* + * The last available backup date time. + */ + @JsonProperty(value = "lastAvailableBackupDateTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastAvailableBackupDateTime; + + /* + * The service level objective + */ + @JsonProperty(value = "serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /* + * Edition of the performance tier. + */ + @JsonProperty(value = "edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /* + * vCore associated with the service level objective + */ + @JsonProperty(value = "vCore", access = JsonProperty.Access.WRITE_ONLY) + private Integer vCore; + + /* + * Hardware generation associated with the service level objective + */ + @JsonProperty(value = "hardwareGeneration", access = JsonProperty.Access.WRITE_ONLY) + private String hardwareGeneration; + + /* + * The MySQL version + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Get the lastAvailableBackupDateTime property: The last available backup date time. + * + * @return the lastAvailableBackupDateTime value. + */ + public String lastAvailableBackupDateTime() { + return this.lastAvailableBackupDateTime; + } + + /** + * Get the serviceLevelObjective property: The service level objective. + * + * @return the serviceLevelObjective value. + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Get the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + public Integer vCore() { + return this.vCore; + } + + /** + * Get the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + public String hardwareGeneration() { + return this.hardwareGeneration; + } + + /** + * Get the version property: The MySQL version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecoverableServerResourceInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecoverableServerResourceInner.java new file mode 100644 index 0000000000000..00cc9684e1958 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/RecoverableServerResourceInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recoverable server resource. */ +@Fluent +public final class RecoverableServerResourceInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RecoverableServerProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RecoverableServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the lastAvailableBackupDateTime property: The last available backup date time. + * + * @return the lastAvailableBackupDateTime value. + */ + public String lastAvailableBackupDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastAvailableBackupDateTime(); + } + + /** + * Get the serviceLevelObjective property: The service level objective. + * + * @return the serviceLevelObjective value. + */ + public String serviceLevelObjective() { + return this.innerProperties() == null ? null : this.innerProperties().serviceLevelObjective(); + } + + /** + * Get the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + public String edition() { + return this.innerProperties() == null ? null : this.innerProperties().edition(); + } + + /** + * Get the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + public Integer vCore() { + return this.innerProperties() == null ? null : this.innerProperties().vCore(); + } + + /** + * Get the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + public String hardwareGeneration() { + return this.innerProperties() == null ? null : this.innerProperties().hardwareGeneration(); + } + + /** + * Get the version property: The MySQL version. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/SecurityAlertPolicyProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/SecurityAlertPolicyProperties.java new file mode 100644 index 0000000000000..29da0bb11a680 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/SecurityAlertPolicyProperties.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a security alert policy. */ +@Fluent +public final class SecurityAlertPolicyProperties { + /* + * Specifies the state of the policy, whether it is enabled or disabled. + */ + @JsonProperty(value = "state", required = true) + private ServerSecurityAlertPolicyState state; + + /* + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly + */ + @JsonProperty(value = "disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "emailAccountAdmins") + private Boolean emailAccountAdmins; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "retentionDays") + private Integer retentionDays; + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @return the state value. + */ + public ServerSecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @param state the state value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withState(ServerSecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model SecurityAlertPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityAlertPolicyProperties.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerAdministratorProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerAdministratorProperties.java new file mode 100644 index 0000000000000..123249cae160f --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerAdministratorProperties.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mysqlflexibleserver.models.AdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** The properties of an server Administrator. */ +@Fluent +public final class ServerAdministratorProperties { + /* + * The type of administrator. + */ + @JsonProperty(value = "administratorType", required = true) + private AdministratorType administratorType; + + /* + * The server administrator login account name. + */ + @JsonProperty(value = "login", required = true) + private String login; + + /* + * The server administrator Sid (Secure ID). + */ + @JsonProperty(value = "sid", required = true) + private UUID sid; + + /* + * The server Active Directory Administrator tenant id. + */ + @JsonProperty(value = "tenantId", required = true) + private UUID tenantId; + + /** + * Get the administratorType property: The type of administrator. + * + * @return the administratorType value. + */ + public AdministratorType administratorType() { + return this.administratorType; + } + + /** + * Set the administratorType property: The type of administrator. + * + * @param administratorType the administratorType value to set. + * @return the ServerAdministratorProperties object itself. + */ + public ServerAdministratorProperties withAdministratorType(AdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the login property: The server administrator login account name. + * + * @return the login value. + */ + public String login() { + return this.login; + } + + /** + * Set the login property: The server administrator login account name. + * + * @param login the login value to set. + * @return the ServerAdministratorProperties object itself. + */ + public ServerAdministratorProperties withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the sid property: The server administrator Sid (Secure ID). + * + * @return the sid value. + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the sid property: The server administrator Sid (Secure ID). + * + * @param sid the sid value to set. + * @return the ServerAdministratorProperties object itself. + */ + public ServerAdministratorProperties withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the tenantId property: The server Active Directory Administrator tenant id. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The server Active Directory Administrator tenant id. + * + * @param tenantId the tenantId value to set. + * @return the ServerAdministratorProperties object itself. + */ + public ServerAdministratorProperties withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (administratorType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorType in model ServerAdministratorProperties")); + } + if (login() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property login in model ServerAdministratorProperties")); + } + if (sid() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sid in model ServerAdministratorProperties")); + } + if (tenantId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property tenantId in model ServerAdministratorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerAdministratorProperties.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerAdministratorResourceInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerAdministratorResourceInner.java new file mode 100644 index 0000000000000..f33c2a3bdcb1c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerAdministratorResourceInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.AdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Represents a and external administrator to be created. */ +@Fluent +public final class ServerAdministratorResourceInner extends ProxyResource { + /* + * Properties of the server AAD administrator. + */ + @JsonProperty(value = "properties") + private ServerAdministratorProperties innerProperties; + + /** + * Get the innerProperties property: Properties of the server AAD administrator. + * + * @return the innerProperties value. + */ + private ServerAdministratorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the administratorType property: The type of administrator. + * + * @return the administratorType value. + */ + public AdministratorType administratorType() { + return this.innerProperties() == null ? null : this.innerProperties().administratorType(); + } + + /** + * Set the administratorType property: The type of administrator. + * + * @param administratorType the administratorType value to set. + * @return the ServerAdministratorResourceInner object itself. + */ + public ServerAdministratorResourceInner withAdministratorType(AdministratorType administratorType) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerAdministratorProperties(); + } + this.innerProperties().withAdministratorType(administratorType); + return this; + } + + /** + * Get the login property: The server administrator login account name. + * + * @return the login value. + */ + public String login() { + return this.innerProperties() == null ? null : this.innerProperties().login(); + } + + /** + * Set the login property: The server administrator login account name. + * + * @param login the login value to set. + * @return the ServerAdministratorResourceInner object itself. + */ + public ServerAdministratorResourceInner withLogin(String login) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerAdministratorProperties(); + } + this.innerProperties().withLogin(login); + return this; + } + + /** + * Get the sid property: The server administrator Sid (Secure ID). + * + * @return the sid value. + */ + public UUID sid() { + return this.innerProperties() == null ? null : this.innerProperties().sid(); + } + + /** + * Set the sid property: The server administrator Sid (Secure ID). + * + * @param sid the sid value to set. + * @return the ServerAdministratorResourceInner object itself. + */ + public ServerAdministratorResourceInner withSid(UUID sid) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerAdministratorProperties(); + } + this.innerProperties().withSid(sid); + return this; + } + + /** + * Get the tenantId property: The server Active Directory Administrator tenant id. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The server Active Directory Administrator tenant id. + * + * @param tenantId the tenantId value to set. + * @return the ServerAdministratorResourceInner object itself. + */ + public ServerAdministratorResourceInner withTenantId(UUID tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerAdministratorProperties(); + } + this.innerProperties().withTenantId(tenantId); + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerBackupInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerBackupInner.java deleted file mode 100644 index 74edd922f10df..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerBackupInner.java +++ /dev/null @@ -1,125 +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.mysqlflexibleserver.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; - -/** Server backup properties. */ -@Fluent -public final class ServerBackupInner extends ProxyResource { - /* - * The properties of a server backup. - */ - @JsonProperty(value = "properties") - private ServerBackupProperties innerProperties; - - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - - /** - * Get the innerProperties property: The properties of a server backup. - * - * @return the innerProperties value. - */ - private ServerBackupProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the backupType property: Backup type. - * - * @return the backupType value. - */ - public String backupType() { - return this.innerProperties() == null ? null : this.innerProperties().backupType(); - } - - /** - * Set the backupType property: Backup type. - * - * @param backupType the backupType value to set. - * @return the ServerBackupInner object itself. - */ - public ServerBackupInner withBackupType(String backupType) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerBackupProperties(); - } - this.innerProperties().withBackupType(backupType); - return this; - } - - /** - * Get the completedTime property: Backup completed time (ISO8601 format). - * - * @return the completedTime value. - */ - public OffsetDateTime completedTime() { - return this.innerProperties() == null ? null : this.innerProperties().completedTime(); - } - - /** - * Set the completedTime property: Backup completed time (ISO8601 format). - * - * @param completedTime the completedTime value to set. - * @return the ServerBackupInner object itself. - */ - public ServerBackupInner withCompletedTime(OffsetDateTime completedTime) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerBackupProperties(); - } - this.innerProperties().withCompletedTime(completedTime); - return this; - } - - /** - * Get the source property: Backup source. - * - * @return the source value. - */ - public String source() { - return this.innerProperties() == null ? null : this.innerProperties().source(); - } - - /** - * Set the source property: Backup source. - * - * @param source the source value to set. - * @return the ServerBackupInner object itself. - */ - public ServerBackupInner withSource(String source) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerBackupProperties(); - } - this.innerProperties().withSource(source); - 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerBackupProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerBackupProperties.java deleted file mode 100644 index 1c23931313bbb..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerBackupProperties.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.mysqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** The properties of a server backup. */ -@Fluent -public final class ServerBackupProperties { - /* - * Backup type. - */ - @JsonProperty(value = "backupType") - private String backupType; - - /* - * Backup completed time (ISO8601 format). - */ - @JsonProperty(value = "completedTime") - private OffsetDateTime completedTime; - - /* - * Backup source - */ - @JsonProperty(value = "source") - private String source; - - /** - * Get the backupType property: Backup type. - * - * @return the backupType value. - */ - public String backupType() { - return this.backupType; - } - - /** - * Set the backupType property: Backup type. - * - * @param backupType the backupType value to set. - * @return the ServerBackupProperties object itself. - */ - public ServerBackupProperties withBackupType(String backupType) { - this.backupType = backupType; - return this; - } - - /** - * Get the completedTime property: Backup completed time (ISO8601 format). - * - * @return the completedTime value. - */ - public OffsetDateTime completedTime() { - return this.completedTime; - } - - /** - * Set the completedTime property: Backup completed time (ISO8601 format). - * - * @param completedTime the completedTime value to set. - * @return the ServerBackupProperties object itself. - */ - public ServerBackupProperties withCompletedTime(OffsetDateTime completedTime) { - this.completedTime = completedTime; - return this; - } - - /** - * Get the source property: Backup source. - * - * @return the source value. - */ - public String source() { - return this.source; - } - - /** - * Set the source property: Backup source. - * - * @param source the source value to set. - * @return the ServerBackupProperties object itself. - */ - public ServerBackupProperties withSource(String source) { - this.source = source; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerInner.java index 7d5ae8a69edeb..c7c3f5752f531 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerInner.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerInner.java @@ -6,31 +6,29 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.resourcemanager.mysqlflexibleserver.models.Backup; -import com.azure.resourcemanager.mysqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryption; -import com.azure.resourcemanager.mysqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.mysqlflexibleserver.models.Identity; -import com.azure.resourcemanager.mysqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.mysqlflexibleserver.models.Network; -import com.azure.resourcemanager.mysqlflexibleserver.models.ReplicationRole; +import com.azure.resourcemanager.mysqlflexibleserver.models.InfrastructureEncryption; +import com.azure.resourcemanager.mysqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.ResourceIdentity; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPrivateEndpointConnection; import com.azure.resourcemanager.mysqlflexibleserver.models.ServerState; import com.azure.resourcemanager.mysqlflexibleserver.models.ServerVersion; import com.azure.resourcemanager.mysqlflexibleserver.models.Sku; -import com.azure.resourcemanager.mysqlflexibleserver.models.Storage; +import com.azure.resourcemanager.mysqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.StorageProfile; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; +import java.util.List; import java.util.Map; /** Represents a server. */ @Fluent public final class ServerInner extends Resource { /* - * The cmk identity for the server. + * The Azure Active Directory identity of the server. */ @JsonProperty(value = "identity") - private Identity identity; + private ResourceIdentity identity; /* * The SKU (pricing tier) of the server. @@ -44,28 +42,22 @@ public final class ServerInner extends Resource { @JsonProperty(value = "properties") private ServerProperties innerProperties; - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /** - * Get the identity property: The cmk identity for the server. + * Get the identity property: The Azure Active Directory identity of the server. * * @return the identity value. */ - public Identity identity() { + public ResourceIdentity identity() { return this.identity; } /** - * Set the identity property: The cmk identity for the server. + * Set the identity property: The Azure Active Directory identity of the server. * * @param identity the identity value to set. * @return the ServerInner object itself. */ - public ServerInner withIdentity(Identity identity) { + public ServerInner withIdentity(ResourceIdentity identity) { this.identity = identity; return this; } @@ -99,15 +91,6 @@ private ServerProperties innerProperties() { return this.innerProperties; } - /** - * Get the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** {@inheritDoc} */ @Override public ServerInner withLocation(String location) { @@ -147,31 +130,6 @@ public ServerInner withAdministratorLogin(String administratorLogin) { return this; } - /** - * Get the administratorLoginPassword property: The password of the administrator login (required for server - * creation). - * - * @return the administratorLoginPassword value. - */ - public String administratorLoginPassword() { - return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); - } - - /** - * Set the administratorLoginPassword property: The password of the administrator login (required for server - * creation). - * - * @param administratorLoginPassword the administratorLoginPassword value to set. - * @return the ServerInner object itself. - */ - public ServerInner withAdministratorLoginPassword(String administratorLoginPassword) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerProperties(); - } - this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); - return this; - } - /** * Get the version property: Server version. * @@ -196,287 +154,279 @@ public ServerInner withVersion(ServerVersion version) { } /** - * Get the availabilityZone property: availability Zone information of the server. + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @return the availabilityZone value. + * @return the sslEnforcement value. */ - public String availabilityZone() { - return this.innerProperties() == null ? null : this.innerProperties().availabilityZone(); + public SslEnforcementEnum sslEnforcement() { + return this.innerProperties() == null ? null : this.innerProperties().sslEnforcement(); } /** - * Set the availabilityZone property: availability Zone information of the server. + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @param availabilityZone the availabilityZone value to set. + * @param sslEnforcement the sslEnforcement value to set. * @return the ServerInner object itself. */ - public ServerInner withAvailabilityZone(String availabilityZone) { + public ServerInner withSslEnforcement(SslEnforcementEnum sslEnforcement) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withAvailabilityZone(availabilityZone); + this.innerProperties().withSslEnforcement(sslEnforcement); return this; } /** - * Get the createMode property: The mode to create a new MySQL server. + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the createMode value. + * @return the minimalTlsVersion value. */ - public CreateMode createMode() { - return this.innerProperties() == null ? null : this.innerProperties().createMode(); + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); } /** - * Set the createMode property: The mode to create a new MySQL server. + * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @param createMode the createMode value to set. + * @param minimalTlsVersion the minimalTlsVersion value to set. * @return the ServerInner object itself. */ - public ServerInner withCreateMode(CreateMode createMode) { + public ServerInner withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withCreateMode(createMode); + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); return this; } /** - * Get the sourceServerResourceId property: The source MySQL server id. + * Get the byokEnforcement property: Status showing whether the server data encryption is enabled with + * customer-managed keys. * - * @return the sourceServerResourceId value. + * @return the byokEnforcement value. */ - public String sourceServerResourceId() { - return this.innerProperties() == null ? null : this.innerProperties().sourceServerResourceId(); + public String byokEnforcement() { + return this.innerProperties() == null ? null : this.innerProperties().byokEnforcement(); } /** - * Set the sourceServerResourceId property: The source MySQL server id. + * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @param sourceServerResourceId the sourceServerResourceId value to set. - * @return the ServerInner object itself. + * @return the infrastructureEncryption value. */ - public ServerInner withSourceServerResourceId(String sourceServerResourceId) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerProperties(); - } - this.innerProperties().withSourceServerResourceId(sourceServerResourceId); - return this; - } - - /** - * Get the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. - * - * @return the restorePointInTime value. - */ - public OffsetDateTime restorePointInTime() { - return this.innerProperties() == null ? null : this.innerProperties().restorePointInTime(); + public InfrastructureEncryption infrastructureEncryption() { + return this.innerProperties() == null ? null : this.innerProperties().infrastructureEncryption(); } /** - * Set the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. + * Set the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @param restorePointInTime the restorePointInTime value to set. + * @param infrastructureEncryption the infrastructureEncryption value to set. * @return the ServerInner object itself. */ - public ServerInner withRestorePointInTime(OffsetDateTime restorePointInTime) { + public ServerInner withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withRestorePointInTime(restorePointInTime); + this.innerProperties().withInfrastructureEncryption(infrastructureEncryption); return this; } /** - * Get the replicationRole property: The replication role. + * Get the userVisibleState property: A state of a server that is visible to user. * - * @return the replicationRole value. + * @return the userVisibleState value. */ - public ReplicationRole replicationRole() { - return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); + public ServerState userVisibleState() { + return this.innerProperties() == null ? null : this.innerProperties().userVisibleState(); } /** - * Set the replicationRole property: The replication role. + * Set the userVisibleState property: A state of a server that is visible to user. * - * @param replicationRole the replicationRole value to set. + * @param userVisibleState the userVisibleState value to set. * @return the ServerInner object itself. */ - public ServerInner withReplicationRole(ReplicationRole replicationRole) { + public ServerInner withUserVisibleState(ServerState userVisibleState) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withReplicationRole(replicationRole); + this.innerProperties().withUserVisibleState(userVisibleState); return this; } /** - * Get the replicaCapacity property: The maximum number of replicas that a primary server can have. - * - * @return the replicaCapacity value. - */ - public Integer replicaCapacity() { - return this.innerProperties() == null ? null : this.innerProperties().replicaCapacity(); - } - - /** - * Get the dataEncryption property: The Data Encryption for CMK. + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @return the dataEncryption value. + * @return the fullyQualifiedDomainName value. */ - public DataEncryption dataEncryption() { - return this.innerProperties() == null ? null : this.innerProperties().dataEncryption(); + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); } /** - * Set the dataEncryption property: The Data Encryption for CMK. + * Set the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @param dataEncryption the dataEncryption value to set. + * @param fullyQualifiedDomainName the fullyQualifiedDomainName value to set. * @return the ServerInner object itself. */ - public ServerInner withDataEncryption(DataEncryption dataEncryption) { + public ServerInner withFullyQualifiedDomainName(String fullyQualifiedDomainName) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withDataEncryption(dataEncryption); + this.innerProperties().withFullyQualifiedDomainName(fullyQualifiedDomainName); return this; } /** - * Get the state property: The state of a server. + * Get the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the state value. + * @return the earliestRestoreDate value. */ - public ServerState state() { - return this.innerProperties() == null ? null : this.innerProperties().state(); + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); } /** - * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * Set the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the fullyQualifiedDomainName value. + * @param earliestRestoreDate the earliestRestoreDate value to set. + * @return the ServerInner object itself. */ - public String fullyQualifiedDomainName() { - return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + public ServerInner withEarliestRestoreDate(OffsetDateTime earliestRestoreDate) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withEarliestRestoreDate(earliestRestoreDate); + return this; } /** - * Get the storage property: Storage related properties of a server. + * Get the storageProfile property: Storage profile of a server. * - * @return the storage value. + * @return the storageProfile value. */ - public Storage storage() { - return this.innerProperties() == null ? null : this.innerProperties().storage(); + public StorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); } /** - * Set the storage property: Storage related properties of a server. + * Set the storageProfile property: Storage profile of a server. * - * @param storage the storage value to set. + * @param storageProfile the storageProfile value to set. * @return the ServerInner object itself. */ - public ServerInner withStorage(Storage storage) { + public ServerInner withStorageProfile(StorageProfile storageProfile) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withStorage(storage); + this.innerProperties().withStorageProfile(storageProfile); return this; } /** - * Get the backup property: Backup related properties of a server. + * Get the replicationRole property: The replication role of the server. * - * @return the backup value. + * @return the replicationRole value. */ - public Backup backup() { - return this.innerProperties() == null ? null : this.innerProperties().backup(); + public String replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); } /** - * Set the backup property: Backup related properties of a server. + * Set the replicationRole property: The replication role of the server. * - * @param backup the backup value to set. + * @param replicationRole the replicationRole value to set. * @return the ServerInner object itself. */ - public ServerInner withBackup(Backup backup) { + public ServerInner withReplicationRole(String replicationRole) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withBackup(backup); + this.innerProperties().withReplicationRole(replicationRole); return this; } /** - * Get the highAvailability property: High availability related properties of a server. + * Get the masterServerId property: The master server id of a replica server. * - * @return the highAvailability value. + * @return the masterServerId value. */ - public HighAvailability highAvailability() { - return this.innerProperties() == null ? null : this.innerProperties().highAvailability(); + public String masterServerId() { + return this.innerProperties() == null ? null : this.innerProperties().masterServerId(); } /** - * Set the highAvailability property: High availability related properties of a server. + * Set the masterServerId property: The master server id of a replica server. * - * @param highAvailability the highAvailability value to set. + * @param masterServerId the masterServerId value to set. * @return the ServerInner object itself. */ - public ServerInner withHighAvailability(HighAvailability highAvailability) { + public ServerInner withMasterServerId(String masterServerId) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withHighAvailability(highAvailability); + this.innerProperties().withMasterServerId(masterServerId); return this; } /** - * Get the network property: Network related properties of a server. + * Get the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @return the network value. + * @return the replicaCapacity value. */ - public Network network() { - return this.innerProperties() == null ? null : this.innerProperties().network(); + public Integer replicaCapacity() { + return this.innerProperties() == null ? null : this.innerProperties().replicaCapacity(); } /** - * Set the network property: Network related properties of a server. + * Set the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @param network the network value to set. + * @param replicaCapacity the replicaCapacity value to set. * @return the ServerInner object itself. */ - public ServerInner withNetwork(Network network) { + public ServerInner withReplicaCapacity(Integer replicaCapacity) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withNetwork(network); + this.innerProperties().withReplicaCapacity(replicaCapacity); return this; } /** - * Get the maintenanceWindow property: Maintenance window of a server. + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. * - * @return the maintenanceWindow value. + * @return the publicNetworkAccess value. */ - public MaintenanceWindow maintenanceWindow() { - return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow(); + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); } /** - * Set the maintenanceWindow property: Maintenance window of a server. + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. * - * @param maintenanceWindow the maintenanceWindow value to set. + * @param publicNetworkAccess the publicNetworkAccess value to set. * @return the ServerInner object itself. */ - public ServerInner withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + public ServerInner withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withMaintenanceWindow(maintenanceWindow); + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); return this; } + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + /** * Validates the instance. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerKeyInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerKeyInner.java new file mode 100644 index 0000000000000..bd7df969bc6b6 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerKeyInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A MySQL Server key. */ +@Fluent +public final class ServerKeyInner extends ProxyResource { + /* + * Kind of encryption protector used to protect the key. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Properties of the ServerKey Resource. + */ + @JsonProperty(value = "properties") + private ServerKeyProperties innerProperties; + + /** + * Get the kind property: Kind of encryption protector used to protect the key. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Properties of the ServerKey Resource. + * + * @return the innerProperties value. + */ + private ServerKeyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the serverKeyType property: The key type like 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().serverKeyType(); + } + + /** + * Set the serverKeyType property: The key type like 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withServerKeyType(ServerKeyType serverKeyType) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerKeyProperties(); + } + this.innerProperties().withServerKeyType(serverKeyType); + return this; + } + + /** + * Get the uri property: The URI of the key. + * + * @return the uri value. + */ + public String uri() { + return this.innerProperties() == null ? null : this.innerProperties().uri(); + } + + /** + * Set the uri property: The URI of the key. + * + * @param uri the uri value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withUri(String uri) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerKeyProperties(); + } + this.innerProperties().withUri(uri); + return this; + } + + /** + * Get the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerKeyProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerKeyProperties.java new file mode 100644 index 0000000000000..da9be2aecd11c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerKeyProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties for a key execution. */ +@Fluent +public final class ServerKeyProperties { + /* + * The key type like 'AzureKeyVault'. + */ + @JsonProperty(value = "serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /* + * The URI of the key. + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * The key creation date. + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /** + * Get the serverKeyType property: The key type like 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The key type like 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ServerKeyProperties object itself. + */ + public ServerKeyProperties withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the key. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The URI of the key. + * + * @param uri the uri value to set. + * @return the ServerKeyProperties object itself. + */ + public ServerKeyProperties withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverKeyType in model ServerKeyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerKeyProperties.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerProperties.java index 68315fb28652f..9e488f8b84662 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerProperties.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerProperties.java @@ -5,18 +5,17 @@ package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.mysqlflexibleserver.models.Backup; -import com.azure.resourcemanager.mysqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryption; -import com.azure.resourcemanager.mysqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.mysqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.mysqlflexibleserver.models.Network; -import com.azure.resourcemanager.mysqlflexibleserver.models.ReplicationRole; +import com.azure.resourcemanager.mysqlflexibleserver.models.InfrastructureEncryption; +import com.azure.resourcemanager.mysqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPrivateEndpointConnection; import com.azure.resourcemanager.mysqlflexibleserver.models.ServerState; import com.azure.resourcemanager.mysqlflexibleserver.models.ServerVersion; -import com.azure.resourcemanager.mysqlflexibleserver.models.Storage; +import com.azure.resourcemanager.mysqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.StorageProfile; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; +import java.util.List; /** The properties of a server. */ @Fluent @@ -28,12 +27,6 @@ public final class ServerProperties { @JsonProperty(value = "administratorLogin") private String administratorLogin; - /* - * The password of the administrator login (required for server creation). - */ - @JsonProperty(value = "administratorLoginPassword") - private String administratorLoginPassword; - /* * Server version. */ @@ -41,89 +34,84 @@ public final class ServerProperties { private ServerVersion version; /* - * availability Zone information of the server. + * Enable ssl enforcement or not when connect to server. */ - @JsonProperty(value = "availabilityZone") - private String availabilityZone; + @JsonProperty(value = "sslEnforcement") + private SslEnforcementEnum sslEnforcement; /* - * The mode to create a new MySQL server. + * Enforce a minimal Tls version for the server. */ - @JsonProperty(value = "createMode") - private CreateMode createMode; + @JsonProperty(value = "minimalTlsVersion") + private MinimalTlsVersionEnum minimalTlsVersion; /* - * The source MySQL server id. + * Status showing whether the server data encryption is enabled with + * customer-managed keys. */ - @JsonProperty(value = "sourceServerResourceId") - private String sourceServerResourceId; + @JsonProperty(value = "byokEnforcement", access = JsonProperty.Access.WRITE_ONLY) + private String byokEnforcement; /* - * Restore point creation time (ISO8601 format), specifying the time to - * restore from. + * Status showing whether the server enabled infrastructure encryption. */ - @JsonProperty(value = "restorePointInTime") - private OffsetDateTime restorePointInTime; + @JsonProperty(value = "infrastructureEncryption") + private InfrastructureEncryption infrastructureEncryption; /* - * The replication role. + * A state of a server that is visible to user. */ - @JsonProperty(value = "replicationRole") - private ReplicationRole replicationRole; + @JsonProperty(value = "userVisibleState") + private ServerState userVisibleState; /* - * The maximum number of replicas that a primary server can have. - */ - @JsonProperty(value = "replicaCapacity", access = JsonProperty.Access.WRITE_ONLY) - private Integer replicaCapacity; - - /* - * The Data Encryption for CMK. + * The fully qualified domain name of a server. */ - @JsonProperty(value = "dataEncryption") - private DataEncryption dataEncryption; + @JsonProperty(value = "fullyQualifiedDomainName") + private String fullyQualifiedDomainName; /* - * The state of a server. + * Earliest restore point creation time (ISO8601 format) */ - @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) - private ServerState state; + @JsonProperty(value = "earliestRestoreDate") + private OffsetDateTime earliestRestoreDate; /* - * The fully qualified domain name of a server. + * Storage profile of a server. */ - @JsonProperty(value = "fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) - private String fullyQualifiedDomainName; + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; /* - * Storage related properties of a server. + * The replication role of the server. */ - @JsonProperty(value = "storage") - private Storage storage; + @JsonProperty(value = "replicationRole") + private String replicationRole; /* - * Backup related properties of a server. + * The master server id of a replica server. */ - @JsonProperty(value = "backup") - private Backup backup; + @JsonProperty(value = "masterServerId") + private String masterServerId; /* - * High availability related properties of a server. + * The maximum number of replicas that a master server can have. */ - @JsonProperty(value = "highAvailability") - private HighAvailability highAvailability; + @JsonProperty(value = "replicaCapacity") + private Integer replicaCapacity; /* - * Network related properties of a server. + * Whether or not public network access is allowed for this server. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' */ - @JsonProperty(value = "network") - private Network network; + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; /* - * Maintenance window of a server. + * List of private endpoint connections on a server */ - @JsonProperty(value = "maintenanceWindow") - private MaintenanceWindow maintenanceWindow; + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; /** * Get the administratorLogin property: The administrator's login name of a server. Can only be specified when the @@ -147,28 +135,6 @@ public ServerProperties withAdministratorLogin(String administratorLogin) { return this; } - /** - * Get the administratorLoginPassword property: The password of the administrator login (required for server - * creation). - * - * @return the administratorLoginPassword value. - */ - public String administratorLoginPassword() { - return this.administratorLoginPassword; - } - - /** - * Set the administratorLoginPassword property: The password of the administrator login (required for server - * creation). - * - * @param administratorLoginPassword the administratorLoginPassword value to set. - * @return the ServerProperties object itself. - */ - public ServerProperties withAdministratorLoginPassword(String administratorLoginPassword) { - this.administratorLoginPassword = administratorLoginPassword; - return this; - } - /** * Get the version property: Server version. * @@ -190,277 +156,257 @@ public ServerProperties withVersion(ServerVersion version) { } /** - * Get the availabilityZone property: availability Zone information of the server. + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @return the availabilityZone value. + * @return the sslEnforcement value. */ - public String availabilityZone() { - return this.availabilityZone; + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; } /** - * Set the availabilityZone property: availability Zone information of the server. + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @param availabilityZone the availabilityZone value to set. + * @param sslEnforcement the sslEnforcement value to set. * @return the ServerProperties object itself. */ - public ServerProperties withAvailabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; + public ServerProperties withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; return this; } /** - * Get the createMode property: The mode to create a new MySQL server. + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the createMode value. + * @return the minimalTlsVersion value. */ - public CreateMode createMode() { - return this.createMode; + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.minimalTlsVersion; } /** - * Set the createMode property: The mode to create a new MySQL server. + * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @param createMode the createMode value to set. + * @param minimalTlsVersion the minimalTlsVersion value to set. * @return the ServerProperties object itself. */ - public ServerProperties withCreateMode(CreateMode createMode) { - this.createMode = createMode; + public ServerProperties withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; return this; } /** - * Get the sourceServerResourceId property: The source MySQL server id. - * - * @return the sourceServerResourceId value. - */ - public String sourceServerResourceId() { - return this.sourceServerResourceId; - } - - /** - * Set the sourceServerResourceId property: The source MySQL server id. + * Get the byokEnforcement property: Status showing whether the server data encryption is enabled with + * customer-managed keys. * - * @param sourceServerResourceId the sourceServerResourceId value to set. - * @return the ServerProperties object itself. + * @return the byokEnforcement value. */ - public ServerProperties withSourceServerResourceId(String sourceServerResourceId) { - this.sourceServerResourceId = sourceServerResourceId; - return this; + public String byokEnforcement() { + return this.byokEnforcement; } /** - * Get the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. + * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @return the restorePointInTime value. + * @return the infrastructureEncryption value. */ - public OffsetDateTime restorePointInTime() { - return this.restorePointInTime; + public InfrastructureEncryption infrastructureEncryption() { + return this.infrastructureEncryption; } /** - * Set the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. + * Set the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @param restorePointInTime the restorePointInTime value to set. + * @param infrastructureEncryption the infrastructureEncryption value to set. * @return the ServerProperties object itself. */ - public ServerProperties withRestorePointInTime(OffsetDateTime restorePointInTime) { - this.restorePointInTime = restorePointInTime; + public ServerProperties withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { + this.infrastructureEncryption = infrastructureEncryption; return this; } /** - * Get the replicationRole property: The replication role. + * Get the userVisibleState property: A state of a server that is visible to user. * - * @return the replicationRole value. + * @return the userVisibleState value. */ - public ReplicationRole replicationRole() { - return this.replicationRole; + public ServerState userVisibleState() { + return this.userVisibleState; } /** - * Set the replicationRole property: The replication role. + * Set the userVisibleState property: A state of a server that is visible to user. * - * @param replicationRole the replicationRole value to set. + * @param userVisibleState the userVisibleState value to set. * @return the ServerProperties object itself. */ - public ServerProperties withReplicationRole(ReplicationRole replicationRole) { - this.replicationRole = replicationRole; + public ServerProperties withUserVisibleState(ServerState userVisibleState) { + this.userVisibleState = userVisibleState; return this; } /** - * Get the replicaCapacity property: The maximum number of replicas that a primary server can have. - * - * @return the replicaCapacity value. - */ - public Integer replicaCapacity() { - return this.replicaCapacity; - } - - /** - * Get the dataEncryption property: The Data Encryption for CMK. + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @return the dataEncryption value. + * @return the fullyQualifiedDomainName value. */ - public DataEncryption dataEncryption() { - return this.dataEncryption; + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; } /** - * Set the dataEncryption property: The Data Encryption for CMK. + * Set the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @param dataEncryption the dataEncryption value to set. + * @param fullyQualifiedDomainName the fullyQualifiedDomainName value to set. * @return the ServerProperties object itself. */ - public ServerProperties withDataEncryption(DataEncryption dataEncryption) { - this.dataEncryption = dataEncryption; + public ServerProperties withFullyQualifiedDomainName(String fullyQualifiedDomainName) { + this.fullyQualifiedDomainName = fullyQualifiedDomainName; return this; } /** - * Get the state property: The state of a server. + * Get the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the state value. + * @return the earliestRestoreDate value. */ - public ServerState state() { - return this.state; + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; } /** - * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * Set the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the fullyQualifiedDomainName value. + * @param earliestRestoreDate the earliestRestoreDate value to set. + * @return the ServerProperties object itself. */ - public String fullyQualifiedDomainName() { - return this.fullyQualifiedDomainName; + public ServerProperties withEarliestRestoreDate(OffsetDateTime earliestRestoreDate) { + this.earliestRestoreDate = earliestRestoreDate; + return this; } /** - * Get the storage property: Storage related properties of a server. + * Get the storageProfile property: Storage profile of a server. * - * @return the storage value. + * @return the storageProfile value. */ - public Storage storage() { - return this.storage; + public StorageProfile storageProfile() { + return this.storageProfile; } /** - * Set the storage property: Storage related properties of a server. + * Set the storageProfile property: Storage profile of a server. * - * @param storage the storage value to set. + * @param storageProfile the storageProfile value to set. * @return the ServerProperties object itself. */ - public ServerProperties withStorage(Storage storage) { - this.storage = storage; + public ServerProperties withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; return this; } /** - * Get the backup property: Backup related properties of a server. + * Get the replicationRole property: The replication role of the server. * - * @return the backup value. + * @return the replicationRole value. */ - public Backup backup() { - return this.backup; + public String replicationRole() { + return this.replicationRole; } /** - * Set the backup property: Backup related properties of a server. + * Set the replicationRole property: The replication role of the server. * - * @param backup the backup value to set. + * @param replicationRole the replicationRole value to set. * @return the ServerProperties object itself. */ - public ServerProperties withBackup(Backup backup) { - this.backup = backup; + public ServerProperties withReplicationRole(String replicationRole) { + this.replicationRole = replicationRole; return this; } /** - * Get the highAvailability property: High availability related properties of a server. + * Get the masterServerId property: The master server id of a replica server. * - * @return the highAvailability value. + * @return the masterServerId value. */ - public HighAvailability highAvailability() { - return this.highAvailability; + public String masterServerId() { + return this.masterServerId; } /** - * Set the highAvailability property: High availability related properties of a server. + * Set the masterServerId property: The master server id of a replica server. * - * @param highAvailability the highAvailability value to set. + * @param masterServerId the masterServerId value to set. * @return the ServerProperties object itself. */ - public ServerProperties withHighAvailability(HighAvailability highAvailability) { - this.highAvailability = highAvailability; + public ServerProperties withMasterServerId(String masterServerId) { + this.masterServerId = masterServerId; return this; } /** - * Get the network property: Network related properties of a server. + * Get the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @return the network value. + * @return the replicaCapacity value. */ - public Network network() { - return this.network; + public Integer replicaCapacity() { + return this.replicaCapacity; } /** - * Set the network property: Network related properties of a server. + * Set the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @param network the network value to set. + * @param replicaCapacity the replicaCapacity value to set. * @return the ServerProperties object itself. */ - public ServerProperties withNetwork(Network network) { - this.network = network; + public ServerProperties withReplicaCapacity(Integer replicaCapacity) { + this.replicaCapacity = replicaCapacity; return this; } /** - * Get the maintenanceWindow property: Maintenance window of a server. + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. * - * @return the maintenanceWindow value. + * @return the publicNetworkAccess value. */ - public MaintenanceWindow maintenanceWindow() { - return this.maintenanceWindow; + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; } /** - * Set the maintenanceWindow property: Maintenance window of a server. + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. * - * @param maintenanceWindow the maintenanceWindow value to set. + * @param publicNetworkAccess the publicNetworkAccess value to set. * @return the ServerProperties object itself. */ - public ServerProperties withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; + public ServerProperties withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; return this; } + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (dataEncryption() != null) { - dataEncryption().validate(); - } - if (storage() != null) { - storage().validate(); - } - if (backup() != null) { - backup().validate(); - } - if (highAvailability() != null) { - highAvailability().validate(); - } - if (network() != null) { - network().validate(); + if (storageProfile() != null) { + storageProfile().validate(); } - if (maintenanceWindow() != null) { - maintenanceWindow().validate(); + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); } } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java deleted file mode 100644 index e58b188c2d664..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java +++ /dev/null @@ -1,223 +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.mysqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.mysqlflexibleserver.models.Backup; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryption; -import com.azure.resourcemanager.mysqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.mysqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.mysqlflexibleserver.models.ReplicationRole; -import com.azure.resourcemanager.mysqlflexibleserver.models.Storage; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The properties that can be updated for a server. */ -@Fluent -public final class ServerPropertiesForUpdate { - /* - * The password of the administrator login. - */ - @JsonProperty(value = "administratorLoginPassword") - private String administratorLoginPassword; - - /* - * Storage related properties of a server. - */ - @JsonProperty(value = "storage") - private Storage storage; - - /* - * Backup related properties of a server. - */ - @JsonProperty(value = "backup") - private Backup backup; - - /* - * High availability related properties of a server. - */ - @JsonProperty(value = "highAvailability") - private HighAvailability highAvailability; - - /* - * Maintenance window of a server. - */ - @JsonProperty(value = "maintenanceWindow") - private MaintenanceWindow maintenanceWindow; - - /* - * The replication role of the server. - */ - @JsonProperty(value = "replicationRole") - private ReplicationRole replicationRole; - - /* - * The Data Encryption for CMK. - */ - @JsonProperty(value = "dataEncryption") - private DataEncryption dataEncryption; - - /** - * Get the administratorLoginPassword property: The password of the administrator login. - * - * @return the administratorLoginPassword value. - */ - public String administratorLoginPassword() { - return this.administratorLoginPassword; - } - - /** - * Set the administratorLoginPassword property: The password of the administrator login. - * - * @param administratorLoginPassword the administratorLoginPassword value to set. - * @return the ServerPropertiesForUpdate object itself. - */ - public ServerPropertiesForUpdate withAdministratorLoginPassword(String administratorLoginPassword) { - this.administratorLoginPassword = administratorLoginPassword; - return this; - } - - /** - * Get the storage property: Storage related properties of a server. - * - * @return the storage value. - */ - public Storage storage() { - return this.storage; - } - - /** - * Set the storage property: Storage related properties of a server. - * - * @param storage the storage value to set. - * @return the ServerPropertiesForUpdate object itself. - */ - public ServerPropertiesForUpdate withStorage(Storage storage) { - this.storage = storage; - return this; - } - - /** - * Get the backup property: Backup related properties of a server. - * - * @return the backup value. - */ - public Backup backup() { - return this.backup; - } - - /** - * Set the backup property: Backup related properties of a server. - * - * @param backup the backup value to set. - * @return the ServerPropertiesForUpdate object itself. - */ - public ServerPropertiesForUpdate withBackup(Backup backup) { - this.backup = backup; - return this; - } - - /** - * Get the highAvailability property: High availability related properties of a server. - * - * @return the highAvailability value. - */ - public HighAvailability highAvailability() { - return this.highAvailability; - } - - /** - * Set the highAvailability property: High availability related properties of a server. - * - * @param highAvailability the highAvailability value to set. - * @return the ServerPropertiesForUpdate object itself. - */ - public ServerPropertiesForUpdate withHighAvailability(HighAvailability highAvailability) { - this.highAvailability = highAvailability; - return this; - } - - /** - * Get the maintenanceWindow property: Maintenance window of a server. - * - * @return the maintenanceWindow value. - */ - public MaintenanceWindow maintenanceWindow() { - return this.maintenanceWindow; - } - - /** - * Set the maintenanceWindow property: Maintenance window of a server. - * - * @param maintenanceWindow the maintenanceWindow value to set. - * @return the ServerPropertiesForUpdate object itself. - */ - public ServerPropertiesForUpdate withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - return this; - } - - /** - * Get the replicationRole property: The replication role of the server. - * - * @return the replicationRole value. - */ - public ReplicationRole replicationRole() { - return this.replicationRole; - } - - /** - * Set the replicationRole property: The replication role of the server. - * - * @param replicationRole the replicationRole value to set. - * @return the ServerPropertiesForUpdate object itself. - */ - public ServerPropertiesForUpdate withReplicationRole(ReplicationRole replicationRole) { - this.replicationRole = replicationRole; - return this; - } - - /** - * Get the dataEncryption property: The Data Encryption for CMK. - * - * @return the dataEncryption value. - */ - public DataEncryption dataEncryption() { - return this.dataEncryption; - } - - /** - * Set the dataEncryption property: The Data Encryption for CMK. - * - * @param dataEncryption the dataEncryption value to set. - * @return the ServerPropertiesForUpdate object itself. - */ - public ServerPropertiesForUpdate withDataEncryption(DataEncryption dataEncryption) { - this.dataEncryption = dataEncryption; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (storage() != null) { - storage().validate(); - } - if (backup() != null) { - backup().validate(); - } - if (highAvailability() != null) { - highAvailability().validate(); - } - if (maintenanceWindow() != null) { - maintenanceWindow().validate(); - } - if (dataEncryption() != null) { - dataEncryption().validate(); - } - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerSecurityAlertPolicyInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..13b549b10cf52 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerSecurityAlertPolicyInner.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A server security alert policy. */ +@Fluent +public final class ServerSecurityAlertPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityAlertPolicyProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityAlertPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @return the state value. + */ + public ServerSecurityAlertPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @param state the state value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withState(ServerSecurityAlertPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.innerProperties() == null ? null : this.innerProperties().disabledAlerts(); + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withDisabledAlerts(disabledAlerts); + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.innerProperties() == null ? null : this.innerProperties().emailAddresses(); + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withEmailAddresses(emailAddresses); + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.innerProperties() == null ? null : this.innerProperties().emailAccountAdmins(); + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerUpdateParametersProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerUpdateParametersProperties.java new file mode 100644 index 0000000000000..eaa444970d68e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerUpdateParametersProperties.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mysqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.mysqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.StorageProfile; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that can be updated for a server. */ +@Fluent +public final class ServerUpdateParametersProperties { + /* + * Storage profile of a server. + */ + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The version of a server. + */ + @JsonProperty(value = "version") + private ServerVersion version; + + /* + * Enable ssl enforcement or not when connect to server. + */ + @JsonProperty(value = "sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /* + * Enforce a minimal Tls version for the server. + */ + @JsonProperty(value = "minimalTlsVersion") + private MinimalTlsVersionEnum minimalTlsVersion; + + /* + * Whether or not public network access is allowed for this server. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; + + /* + * The replication role of the server. + */ + @JsonProperty(value = "replicationRole") + private String replicationRole; + + /** + * Get the storageProfile property: Storage profile of a server. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Storage profile of a server. + * + * @param storageProfile the storageProfile value to set. + * @return the ServerUpdateParametersProperties object itself. + */ + public ServerUpdateParametersProperties withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerUpdateParametersProperties object itself. + */ + public ServerUpdateParametersProperties withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version property: The version of a server. + * + * @return the version value. + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version property: The version of a server. + * + * @param version the version value to set. + * @return the ServerUpdateParametersProperties object itself. + */ + public ServerUpdateParametersProperties withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @return the sslEnforcement value. + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @param sslEnforcement the sslEnforcement value to set. + * @return the ServerUpdateParametersProperties object itself. + */ + public ServerUpdateParametersProperties withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerUpdateParametersProperties object itself. + */ + public ServerUpdateParametersProperties withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerUpdateParametersProperties object itself. + */ + public ServerUpdateParametersProperties withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the replicationRole property: The replication role of the server. + * + * @return the replicationRole value. + */ + public String replicationRole() { + return this.replicationRole; + } + + /** + * Set the replicationRole property: The replication role of the server. + * + * @param replicationRole the replicationRole value to set. + * @return the ServerUpdateParametersProperties object itself. + */ + public ServerUpdateParametersProperties withReplicationRole(String replicationRole) { + this.replicationRole = replicationRole; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageProfile() != null) { + storageProfile().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerUpgradeParametersProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerUpgradeParametersProperties.java new file mode 100644 index 0000000000000..ba8c668afda66 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/ServerUpgradeParametersProperties.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.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that can be updated for a server. */ +@Fluent +public final class ServerUpgradeParametersProperties { + /* + * Represents an server storage profile. + */ + @JsonProperty(value = "targetServerVersion") + private String targetServerVersion; + + /** + * Get the targetServerVersion property: Represents an server storage profile. + * + * @return the targetServerVersion value. + */ + public String targetServerVersion() { + return this.targetServerVersion; + } + + /** + * Set the targetServerVersion property: Represents an server storage profile. + * + * @param targetServerVersion the targetServerVersion value to set. + * @return the ServerUpgradeParametersProperties object itself. + */ + public ServerUpgradeParametersProperties withTargetServerVersion(String targetServerVersion) { + this.targetServerVersion = targetServerVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/TopQueryStatisticsInputProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/TopQueryStatisticsInputProperties.java new file mode 100644 index 0000000000000..b38a398ae4918 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/TopQueryStatisticsInputProperties.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties for input to get top query statistics. */ +@Fluent +public final class TopQueryStatisticsInputProperties { + /* + * Max number of top queries to return. + */ + @JsonProperty(value = "numberOfTopQueries", required = true) + private int numberOfTopQueries; + + /* + * Aggregation function name. + */ + @JsonProperty(value = "aggregationFunction", required = true) + private String aggregationFunction; + + /* + * Observed metric name. + */ + @JsonProperty(value = "observedMetric", required = true) + private String observedMetric; + + /* + * Observation start time. + */ + @JsonProperty(value = "observationStartTime", required = true) + private OffsetDateTime observationStartTime; + + /* + * Observation end time. + */ + @JsonProperty(value = "observationEndTime", required = true) + private OffsetDateTime observationEndTime; + + /* + * Aggregation interval type in ISO 8601 format. + */ + @JsonProperty(value = "aggregationWindow", required = true) + private String aggregationWindow; + + /** + * Get the numberOfTopQueries property: Max number of top queries to return. + * + * @return the numberOfTopQueries value. + */ + public int numberOfTopQueries() { + return this.numberOfTopQueries; + } + + /** + * Set the numberOfTopQueries property: Max number of top queries to return. + * + * @param numberOfTopQueries the numberOfTopQueries value to set. + * @return the TopQueryStatisticsInputProperties object itself. + */ + public TopQueryStatisticsInputProperties withNumberOfTopQueries(int numberOfTopQueries) { + this.numberOfTopQueries = numberOfTopQueries; + return this; + } + + /** + * Get the aggregationFunction property: Aggregation function name. + * + * @return the aggregationFunction value. + */ + public String aggregationFunction() { + return this.aggregationFunction; + } + + /** + * Set the aggregationFunction property: Aggregation function name. + * + * @param aggregationFunction the aggregationFunction value to set. + * @return the TopQueryStatisticsInputProperties object itself. + */ + public TopQueryStatisticsInputProperties withAggregationFunction(String aggregationFunction) { + this.aggregationFunction = aggregationFunction; + return this; + } + + /** + * Get the observedMetric property: Observed metric name. + * + * @return the observedMetric value. + */ + public String observedMetric() { + return this.observedMetric; + } + + /** + * Set the observedMetric property: Observed metric name. + * + * @param observedMetric the observedMetric value to set. + * @return the TopQueryStatisticsInputProperties object itself. + */ + public TopQueryStatisticsInputProperties withObservedMetric(String observedMetric) { + this.observedMetric = observedMetric; + return this; + } + + /** + * Get the observationStartTime property: Observation start time. + * + * @return the observationStartTime value. + */ + public OffsetDateTime observationStartTime() { + return this.observationStartTime; + } + + /** + * Set the observationStartTime property: Observation start time. + * + * @param observationStartTime the observationStartTime value to set. + * @return the TopQueryStatisticsInputProperties object itself. + */ + public TopQueryStatisticsInputProperties withObservationStartTime(OffsetDateTime observationStartTime) { + this.observationStartTime = observationStartTime; + return this; + } + + /** + * Get the observationEndTime property: Observation end time. + * + * @return the observationEndTime value. + */ + public OffsetDateTime observationEndTime() { + return this.observationEndTime; + } + + /** + * Set the observationEndTime property: Observation end time. + * + * @param observationEndTime the observationEndTime value to set. + * @return the TopQueryStatisticsInputProperties object itself. + */ + public TopQueryStatisticsInputProperties withObservationEndTime(OffsetDateTime observationEndTime) { + this.observationEndTime = observationEndTime; + return this; + } + + /** + * Get the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @return the aggregationWindow value. + */ + public String aggregationWindow() { + return this.aggregationWindow; + } + + /** + * Set the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @param aggregationWindow the aggregationWindow value to set. + * @return the TopQueryStatisticsInputProperties object itself. + */ + public TopQueryStatisticsInputProperties withAggregationWindow(String aggregationWindow) { + this.aggregationWindow = aggregationWindow; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (aggregationFunction() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property aggregationFunction in model TopQueryStatisticsInputProperties")); + } + if (observedMetric() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observedMetric in model TopQueryStatisticsInputProperties")); + } + if (observationStartTime() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observationStartTime in model TopQueryStatisticsInputProperties")); + } + if (observationEndTime() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observationEndTime in model TopQueryStatisticsInputProperties")); + } + if (aggregationWindow() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property aggregationWindow in model TopQueryStatisticsInputProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TopQueryStatisticsInputProperties.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/VirtualNetworkRuleInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/VirtualNetworkRuleInner.java new file mode 100644 index 0000000000000..d55cb30e11283 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/VirtualNetworkRuleInner.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A virtual network rule. */ +@Fluent +public final class VirtualNetworkRuleInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VirtualNetworkRuleProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualNetworkRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + public String virtualNetworkSubnetId() { + return this.innerProperties() == null ? null : this.innerProperties().virtualNetworkSubnetId(); + } + + /** + * Set the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set. + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkRuleProperties(); + } + this.innerProperties().withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return this; + } + + /** + * Get the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().ignoreMissingVnetServiceEndpoint(); + } + + /** + * Set the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set. + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkRuleProperties(); + } + this.innerProperties().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } + + /** + * Get the state property: Virtual Network Rule State. + * + * @return the state value. + */ + public VirtualNetworkRuleState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/VirtualNetworkRuleProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/VirtualNetworkRuleProperties.java new file mode 100644 index 0000000000000..bc0f1a9338c3f --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/VirtualNetworkRuleProperties.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a virtual network rule. */ +@Fluent +public final class VirtualNetworkRuleProperties { + /* + * The ARM resource id of the virtual network subnet. + */ + @JsonProperty(value = "virtualNetworkSubnetId", required = true) + private String virtualNetworkSubnetId; + + /* + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /* + * Virtual Network Rule State + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private VirtualNetworkRuleState state; + + /** + * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + public String virtualNetworkSubnetId() { + return this.virtualNetworkSubnetId; + } + + /** + * Set the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set. + * @return the VirtualNetworkRuleProperties object itself. + */ + public VirtualNetworkRuleProperties withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.virtualNetworkSubnetId = virtualNetworkSubnetId; + return this; + } + + /** + * Get the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set. + * @return the VirtualNetworkRuleProperties object itself. + */ + public VirtualNetworkRuleProperties withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Get the state property: Virtual Network Rule State. + * + * @return the state value. + */ + public VirtualNetworkRuleState state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualNetworkSubnetId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property virtualNetworkSubnetId in model VirtualNetworkRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkRuleProperties.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java deleted file mode 100644 index 62ab410825e92..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.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.mysqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.mysqlflexibleserver.models.DelegatedSubnetUsage; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Virtual network subnet usage data. */ -@Immutable -public final class VirtualNetworkSubnetUsageResultInner { - /* - * A list of delegated subnet usage - */ - @JsonProperty(value = "delegatedSubnetsUsage", access = JsonProperty.Access.WRITE_ONLY) - private List delegatedSubnetsUsage; - - /** - * Get the delegatedSubnetsUsage property: A list of delegated subnet usage. - * - * @return the delegatedSubnetsUsage value. - */ - public List delegatedSubnetsUsage() { - return this.delegatedSubnetsUsage; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (delegatedSubnetsUsage() != null) { - delegatedSubnetsUsage().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/WaitStatisticInner.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/WaitStatisticInner.java new file mode 100644 index 0000000000000..be1e8f78dbbf7 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/WaitStatisticInner.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a Wait Statistic. */ +@Fluent +public final class WaitStatisticInner extends ProxyResource { + /* + * The properties of a wait statistic. + */ + @JsonProperty(value = "properties") + private WaitStatisticProperties innerProperties; + + /** + * Get the innerProperties property: The properties of a wait statistic. + * + * @return the innerProperties value. + */ + private WaitStatisticProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the startTime property: Observation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Set the startTime property: Observation start time. + * + * @param startTime the startTime value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withStartTime(OffsetDateTime startTime) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticProperties(); + } + this.innerProperties().withStartTime(startTime); + return this; + } + + /** + * Get the endTime property: Observation end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Set the endTime property: Observation end time. + * + * @param endTime the endTime value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withEndTime(OffsetDateTime endTime) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticProperties(); + } + this.innerProperties().withEndTime(endTime); + return this; + } + + /** + * Get the eventName property: Wait event name. + * + * @return the eventName value. + */ + public String eventName() { + return this.innerProperties() == null ? null : this.innerProperties().eventName(); + } + + /** + * Set the eventName property: Wait event name. + * + * @param eventName the eventName value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withEventName(String eventName) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticProperties(); + } + this.innerProperties().withEventName(eventName); + return this; + } + + /** + * Get the eventTypeName property: Wait event type name. + * + * @return the eventTypeName value. + */ + public String eventTypeName() { + return this.innerProperties() == null ? null : this.innerProperties().eventTypeName(); + } + + /** + * Set the eventTypeName property: Wait event type name. + * + * @param eventTypeName the eventTypeName value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withEventTypeName(String eventTypeName) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticProperties(); + } + this.innerProperties().withEventTypeName(eventTypeName); + return this; + } + + /** + * Get the queryId property: Database query identifier. + * + * @return the queryId value. + */ + public Long queryId() { + return this.innerProperties() == null ? null : this.innerProperties().queryId(); + } + + /** + * Set the queryId property: Database query identifier. + * + * @param queryId the queryId value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withQueryId(Long queryId) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticProperties(); + } + this.innerProperties().withQueryId(queryId); + return this; + } + + /** + * Get the databaseName property: Database Name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Set the databaseName property: Database Name. + * + * @param databaseName the databaseName value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withDatabaseName(String databaseName) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticProperties(); + } + this.innerProperties().withDatabaseName(databaseName); + return this; + } + + /** + * Get the userId property: Database user identifier. + * + * @return the userId value. + */ + public Long userId() { + return this.innerProperties() == null ? null : this.innerProperties().userId(); + } + + /** + * Set the userId property: Database user identifier. + * + * @param userId the userId value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withUserId(Long userId) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticProperties(); + } + this.innerProperties().withUserId(userId); + return this; + } + + /** + * Get the count property: Wait event count observed in this time interval. + * + * @return the count value. + */ + public Long count() { + return this.innerProperties() == null ? null : this.innerProperties().count(); + } + + /** + * Set the count property: Wait event count observed in this time interval. + * + * @param count the count value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withCount(Long count) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticProperties(); + } + this.innerProperties().withCount(count); + return this; + } + + /** + * Get the totalTimeInMs property: Total time of wait in milliseconds in this time interval. + * + * @return the totalTimeInMs value. + */ + public Double totalTimeInMs() { + return this.innerProperties() == null ? null : this.innerProperties().totalTimeInMs(); + } + + /** + * Set the totalTimeInMs property: Total time of wait in milliseconds in this time interval. + * + * @param totalTimeInMs the totalTimeInMs value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withTotalTimeInMs(Double totalTimeInMs) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticProperties(); + } + this.innerProperties().withTotalTimeInMs(totalTimeInMs); + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/WaitStatisticProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/WaitStatisticProperties.java new file mode 100644 index 0000000000000..502eaaf497a1b --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/WaitStatisticProperties.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a wait statistic. */ +@Fluent +public final class WaitStatisticProperties { + /* + * Observation start time. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Observation end time. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * Wait event name. + */ + @JsonProperty(value = "eventName") + private String eventName; + + /* + * Wait event type name. + */ + @JsonProperty(value = "eventTypeName") + private String eventTypeName; + + /* + * Database query identifier. + */ + @JsonProperty(value = "queryId") + private Long queryId; + + /* + * Database Name. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * Database user identifier. + */ + @JsonProperty(value = "userId") + private Long userId; + + /* + * Wait event count observed in this time interval. + */ + @JsonProperty(value = "count") + private Long count; + + /* + * Total time of wait in milliseconds in this time interval. + */ + @JsonProperty(value = "totalTimeInMs") + private Double totalTimeInMs; + + /** + * Get the startTime property: Observation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Observation start time. + * + * @param startTime the startTime value to set. + * @return the WaitStatisticProperties object itself. + */ + public WaitStatisticProperties withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Observation end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Observation end time. + * + * @param endTime the endTime value to set. + * @return the WaitStatisticProperties object itself. + */ + public WaitStatisticProperties withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the eventName property: Wait event name. + * + * @return the eventName value. + */ + public String eventName() { + return this.eventName; + } + + /** + * Set the eventName property: Wait event name. + * + * @param eventName the eventName value to set. + * @return the WaitStatisticProperties object itself. + */ + public WaitStatisticProperties withEventName(String eventName) { + this.eventName = eventName; + return this; + } + + /** + * Get the eventTypeName property: Wait event type name. + * + * @return the eventTypeName value. + */ + public String eventTypeName() { + return this.eventTypeName; + } + + /** + * Set the eventTypeName property: Wait event type name. + * + * @param eventTypeName the eventTypeName value to set. + * @return the WaitStatisticProperties object itself. + */ + public WaitStatisticProperties withEventTypeName(String eventTypeName) { + this.eventTypeName = eventTypeName; + return this; + } + + /** + * Get the queryId property: Database query identifier. + * + * @return the queryId value. + */ + public Long queryId() { + return this.queryId; + } + + /** + * Set the queryId property: Database query identifier. + * + * @param queryId the queryId value to set. + * @return the WaitStatisticProperties object itself. + */ + public WaitStatisticProperties withQueryId(Long queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the databaseName property: Database Name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: Database Name. + * + * @param databaseName the databaseName value to set. + * @return the WaitStatisticProperties object itself. + */ + public WaitStatisticProperties withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the userId property: Database user identifier. + * + * @return the userId value. + */ + public Long userId() { + return this.userId; + } + + /** + * Set the userId property: Database user identifier. + * + * @param userId the userId value to set. + * @return the WaitStatisticProperties object itself. + */ + public WaitStatisticProperties withUserId(Long userId) { + this.userId = userId; + return this; + } + + /** + * Get the count property: Wait event count observed in this time interval. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Set the count property: Wait event count observed in this time interval. + * + * @param count the count value to set. + * @return the WaitStatisticProperties object itself. + */ + public WaitStatisticProperties withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get the totalTimeInMs property: Total time of wait in milliseconds in this time interval. + * + * @return the totalTimeInMs value. + */ + public Double totalTimeInMs() { + return this.totalTimeInMs; + } + + /** + * Set the totalTimeInMs property: Total time of wait in milliseconds in this time interval. + * + * @param totalTimeInMs the totalTimeInMs value to set. + * @return the WaitStatisticProperties object itself. + */ + public WaitStatisticProperties withTotalTimeInMs(Double totalTimeInMs) { + this.totalTimeInMs = totalTimeInMs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/WaitStatisticsInputProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/WaitStatisticsInputProperties.java new file mode 100644 index 0000000000000..f7fd11bab7138 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/fluent/models/WaitStatisticsInputProperties.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.mysqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties for input to get wait statistics. */ +@Fluent +public final class WaitStatisticsInputProperties { + /* + * Observation start time. + */ + @JsonProperty(value = "observationStartTime", required = true) + private OffsetDateTime observationStartTime; + + /* + * Observation end time. + */ + @JsonProperty(value = "observationEndTime", required = true) + private OffsetDateTime observationEndTime; + + /* + * Aggregation interval type in ISO 8601 format. + */ + @JsonProperty(value = "aggregationWindow", required = true) + private String aggregationWindow; + + /** + * Get the observationStartTime property: Observation start time. + * + * @return the observationStartTime value. + */ + public OffsetDateTime observationStartTime() { + return this.observationStartTime; + } + + /** + * Set the observationStartTime property: Observation start time. + * + * @param observationStartTime the observationStartTime value to set. + * @return the WaitStatisticsInputProperties object itself. + */ + public WaitStatisticsInputProperties withObservationStartTime(OffsetDateTime observationStartTime) { + this.observationStartTime = observationStartTime; + return this; + } + + /** + * Get the observationEndTime property: Observation end time. + * + * @return the observationEndTime value. + */ + public OffsetDateTime observationEndTime() { + return this.observationEndTime; + } + + /** + * Set the observationEndTime property: Observation end time. + * + * @param observationEndTime the observationEndTime value to set. + * @return the WaitStatisticsInputProperties object itself. + */ + public WaitStatisticsInputProperties withObservationEndTime(OffsetDateTime observationEndTime) { + this.observationEndTime = observationEndTime; + return this; + } + + /** + * Get the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @return the aggregationWindow value. + */ + public String aggregationWindow() { + return this.aggregationWindow; + } + + /** + * Set the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @param aggregationWindow the aggregationWindow value to set. + * @return the WaitStatisticsInputProperties object itself. + */ + public WaitStatisticsInputProperties withAggregationWindow(String aggregationWindow) { + this.aggregationWindow = aggregationWindow; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (observationStartTime() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observationStartTime in model WaitStatisticsInputProperties")); + } + if (observationEndTime() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observationEndTime in model WaitStatisticsInputProperties")); + } + if (aggregationWindow() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property aggregationWindow in model WaitStatisticsInputProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WaitStatisticsInputProperties.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/GetPrivateDnsZoneSuffixResponseImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/AdvisorImpl.java similarity index 50% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/GetPrivateDnsZoneSuffixResponseImpl.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/AdvisorImpl.java index 3dc69782ccc0e..335b04c3a52e6 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/GetPrivateDnsZoneSuffixResponseImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/AdvisorImpl.java @@ -4,26 +4,36 @@ package com.azure.resourcemanager.mysqlflexibleserver.implementation; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.GetPrivateDnsZoneSuffixResponseInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.GetPrivateDnsZoneSuffixResponse; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.AdvisorInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.Advisor; -public final class GetPrivateDnsZoneSuffixResponseImpl implements GetPrivateDnsZoneSuffixResponse { - private GetPrivateDnsZoneSuffixResponseInner innerObject; +public final class AdvisorImpl implements Advisor { + private AdvisorInner innerObject; private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - GetPrivateDnsZoneSuffixResponseImpl( - GetPrivateDnsZoneSuffixResponseInner innerObject, - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + AdvisorImpl(AdvisorInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } - public String privateDnsZoneSuffix() { - return this.innerModel().privateDnsZoneSuffix(); + public String id() { + return this.innerModel().id(); } - public GetPrivateDnsZoneSuffixResponseInner innerModel() { + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public AdvisorInner innerModel() { return this.innerObject; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/BackupsClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/AdvisorsClientImpl.java similarity index 77% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/BackupsClientImpl.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/AdvisorsClientImpl.java index 8c9a069693fe7..b1afc48627e6d 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/BackupsClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/AdvisorsClientImpl.java @@ -25,59 +25,59 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.BackupsClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerBackupInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerBackupListResult; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.AdvisorsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.AdvisorInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.AdvisorsResultList; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in BackupsClient. */ -public final class BackupsClientImpl implements BackupsClient { +/** An instance of this class provides access to all the operations defined in AdvisorsClient. */ +public final class AdvisorsClientImpl implements AdvisorsClient { /** The proxy service used to perform REST calls. */ - private final BackupsService service; + private final AdvisorsService service; /** The service client containing this operation class. */ private final MySqlManagementClientImpl client; /** - * Initializes an instance of BackupsClientImpl. + * Initializes an instance of AdvisorsClientImpl. * * @param client the instance of the service client containing this operation class. */ - BackupsClientImpl(MySqlManagementClientImpl client) { - this.service = RestProxy.create(BackupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + AdvisorsClientImpl(MySqlManagementClientImpl client) { + this.service = RestProxy.create(AdvisorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for MySqlManagementClientBackups to be used by the proxy service to + * The interface defining all the services for MySqlManagementClientAdvisors to be used by the proxy service to * perform REST calls. */ @Host("{$host}") @ServiceInterface(name = "MySqlManagementClien") - private interface BackupsService { + private interface AdvisorsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/backups/{backupName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/advisors/{advisorName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get( + 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, + @PathParam("advisorName") String advisorName, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/backups") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/advisors") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByServer( + Mono> listByServer( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -90,7 +90,7 @@ Mono> listByServer( @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByServerNext( + Mono> listByServerNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, @@ -98,19 +98,19 @@ Mono> listByServerNext( } /** - * List all the backups for a given server. + * Get a recommendation action advisor. * * @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 advisorName The advisor name for recommendation action. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return server backup properties along with {@link Response} on successful completion of {@link Mono}. + * @return a recommendation action advisor along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync( - String resourceGroupName, String serverName, String backupName) { + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -130,9 +130,10 @@ private Mono> getWithResponseAsync( 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.")); + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); } + final String apiVersion = "2018-06-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -140,31 +141,31 @@ private Mono> getWithResponseAsync( service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, - backupName, + advisorName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List all the backups for a given server. + * Get a recommendation action advisor. * * @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 advisorName The advisor name for recommendation action. * @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 server backup properties along with {@link Response} on successful completion of {@link Mono}. + * @return a recommendation action advisor 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) { + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -184,94 +185,87 @@ private Mono> getWithResponseAsync( 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.")); + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); } + final String apiVersion = "2018-06-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, - backupName, + advisorName, accept, context); } /** - * List all the backups for a given server. + * Get a recommendation action advisor. * * @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 advisorName The advisor name for recommendation action. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return server backup properties on successful completion of {@link Mono}. + * @return a recommendation action advisor on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String serverName, String backupName) { - return getWithResponseAsync(resourceGroupName, serverName, backupName) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + private Mono getAsync(String resourceGroupName, String serverName, String advisorName) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * List all the backups for a given server. + * Get a recommendation action advisor. * * @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 advisorName The advisor name for recommendation action. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return server backup properties. + * @return a recommendation action advisor. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerBackupInner get(String resourceGroupName, String serverName, String backupName) { - return getAsync(resourceGroupName, serverName, backupName).block(); + public AdvisorInner get(String resourceGroupName, String serverName, String advisorName) { + return getAsync(resourceGroupName, serverName, advisorName).block(); } /** - * List all the backups for a given server. + * Get a recommendation action advisor. * * @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 advisorName The advisor name for recommendation action. * @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 server backup properties along with {@link Response}. + * @return a recommendation action advisor 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(); + public Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName, context).block(); } /** - * List all the backups for a given server. + * List recommendation action advisors. * * @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 server backups along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of query statistics along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerSinglePageAsync( - String resourceGroupName, String serverName) { + private Mono> listByServerSinglePageAsync(String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -291,6 +285,7 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2018-06-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -298,13 +293,13 @@ private Mono> listByServerSinglePageAsync( service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, accept, context)) - .>map( + .>map( res -> new PagedResponseBase<>( res.getRequest(), @@ -317,7 +312,7 @@ private Mono> listByServerSinglePageAsync( } /** - * List all the backups for a given server. + * List recommendation action advisors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -325,10 +320,10 @@ private Mono> listByServerSinglePageAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server backups along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of query statistics along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerSinglePageAsync( + private Mono> listByServerSinglePageAsync( String resourceGroupName, String serverName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -349,12 +344,13 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2018-06-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -372,24 +368,24 @@ private Mono> listByServerSinglePageAsync( } /** - * List all the backups for a given server. + * List recommendation action advisors. * * @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 server backups as paginated response with {@link PagedFlux}. + * @return a list of query statistics as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { return new PagedFlux<>( () -> listByServerSinglePageAsync(resourceGroupName, serverName), nextLink -> listByServerNextSinglePageAsync(nextLink)); } /** - * List all the backups for a given server. + * List recommendation action advisors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -397,33 +393,32 @@ private PagedFlux listByServerAsync(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server backups as paginated response with {@link PagedFlux}. + * @return a list of query statistics as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync( - String resourceGroupName, String serverName, Context context) { + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { return new PagedFlux<>( () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), nextLink -> listByServerNextSinglePageAsync(nextLink, context)); } /** - * List all the backups for a given server. + * List recommendation action advisors. * * @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 server backups as paginated response with {@link PagedIterable}. + * @return a list of query statistics as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByServer(String resourceGroupName, String serverName) { + public PagedIterable listByServer(String resourceGroupName, String serverName) { return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); } /** - * List all the backups for a given server. + * List recommendation action advisors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -431,10 +426,10 @@ public PagedIterable listByServer(String resourceGroupName, S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server backups as paginated response with {@link PagedIterable}. + * @return a list of query statistics as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); } @@ -445,10 +440,10 @@ public PagedIterable listByServer(String resourceGroupName, S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server backups along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of query statistics along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink) { + private Mono> listByServerNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -461,7 +456,7 @@ private Mono> listByServerNextSinglePageAsync(S final String accept = "application/json"; return FluxUtil .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( + .>map( res -> new PagedResponseBase<>( res.getRequest(), @@ -481,10 +476,10 @@ private Mono> listByServerNextSinglePageAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server backups along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of query statistics along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/AdvisorsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/AdvisorsImpl.java new file mode 100644 index 0000000000000..032f7470f6a0b --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/AdvisorsImpl.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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.AdvisorsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.AdvisorInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.Advisor; +import com.azure.resourcemanager.mysqlflexibleserver.models.Advisors; + +public final class AdvisorsImpl implements Advisors { + private static final ClientLogger LOGGER = new ClientLogger(AdvisorsImpl.class); + + private final AdvisorsClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public AdvisorsImpl( + AdvisorsClient innerClient, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Advisor get(String resourceGroupName, String serverName, String advisorName) { + AdvisorInner inner = this.serviceClient().get(resourceGroupName, serverName, advisorName); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, advisorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), 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 AdvisorImpl(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 AdvisorImpl(inner1, this.manager())); + } + + private AdvisorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/BackupsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/BackupsImpl.java deleted file mode 100644 index 264fbb15ca655..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/BackupsImpl.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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.BackupsClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerBackupInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.Backups; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerBackup; - -public final class BackupsImpl implements Backups { - private static final ClientLogger LOGGER = new ClientLogger(BackupsImpl.class); - - private final BackupsClient innerClient; - - private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - - public BackupsImpl( - BackupsClient innerClient, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public ServerBackup get(String resourceGroupName, String serverName, String backupName) { - ServerBackupInner inner = this.serviceClient().get(resourceGroupName, serverName, backupName); - if (inner != null) { - return new ServerBackupImpl(inner, this.manager()); - } else { - return null; - } - } - - 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 ServerBackupImpl(inner.getValue(), 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 ServerBackupImpl(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 ServerBackupImpl(inner1, this.manager())); - } - - private BackupsClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CapabilityPropertiesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CapabilityPropertiesImpl.java deleted file mode 100644 index 65bd56073caf3..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CapabilityPropertiesImpl.java +++ /dev/null @@ -1,63 +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.mysqlflexibleserver.implementation; - -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.CapabilityProperties; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerEditionCapability; -import java.util.Collections; -import java.util.List; - -public final class CapabilityPropertiesImpl implements CapabilityProperties { - private CapabilityPropertiesInner innerObject; - - private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - - CapabilityPropertiesImpl( - CapabilityPropertiesInner innerObject, - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 List supportedGeoBackupRegions() { - List inner = this.innerModel().supportedGeoBackupRegions(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public List supportedFlexibleServerEditions() { - List inner = this.innerModel().supportedFlexibleServerEditions(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public CapabilityPropertiesInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java index c947c2109626c..2ef450b5ab2d6 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java @@ -55,26 +55,22 @@ public final class CheckNameAvailabilitiesClientImpl implements CheckNameAvailab @ServiceInterface(name = "MySqlManagementClien") private interface CheckNameAvailabilitiesService { @Headers({"Content-Type: application/json"}) - @Post( - "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}" - + "/checkNameAvailability") + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> execute( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("locationName") String locationName, @BodyParam("application/json") NameAvailabilityRequest nameAvailabilityRequest, @HeaderParam("Accept") String accept, Context context); } /** - * Check the availability of name for server. + * Check the availability of name for resource. * - * @param locationName The name of the location. - * @param nameAvailabilityRequest The required parameters for checking if server name is available. + * @param nameAvailabilityRequest The required parameters for checking if resource 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. @@ -83,7 +79,7 @@ Mono> execute( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> executeWithResponseAsync( - String locationName, NameAvailabilityRequest nameAvailabilityRequest) { + NameAvailabilityRequest nameAvailabilityRequest) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -96,9 +92,6 @@ private Mono> executeWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); - } if (nameAvailabilityRequest == null) { return Mono .error( @@ -106,6 +99,7 @@ private Mono> executeWithResponseAsync( } else { nameAvailabilityRequest.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -113,9 +107,8 @@ private Mono> executeWithResponseAsync( service .execute( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), - locationName, nameAvailabilityRequest, accept, context)) @@ -123,10 +116,9 @@ private Mono> executeWithResponseAsync( } /** - * Check the availability of name for server. + * Check the availability of name for resource. * - * @param locationName The name of the location. - * @param nameAvailabilityRequest The required parameters for checking if server name is available. + * @param nameAvailabilityRequest The required parameters for checking if resource 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. @@ -136,7 +128,7 @@ private Mono> executeWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> executeWithResponseAsync( - String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context) { + NameAvailabilityRequest nameAvailabilityRequest, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -149,9 +141,6 @@ private Mono> executeWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); - } if (nameAvailabilityRequest == null) { return Mono .error( @@ -159,63 +148,51 @@ private Mono> executeWithResponseAsync( } else { nameAvailabilityRequest.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .execute( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), - locationName, nameAvailabilityRequest, accept, context); } /** - * Check the availability of name for server. + * Check the availability of name for resource. * - * @param locationName The name of the location. - * @param nameAvailabilityRequest The required parameters for checking if server name is available. + * @param nameAvailabilityRequest The required parameters for checking if resource 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 resource name availability on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono executeAsync( - String locationName, NameAvailabilityRequest nameAvailabilityRequest) { - return executeWithResponseAsync(locationName, nameAvailabilityRequest) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + private Mono executeAsync(NameAvailabilityRequest nameAvailabilityRequest) { + return executeWithResponseAsync(nameAvailabilityRequest).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Check the availability of name for server. + * Check the availability of name for resource. * - * @param locationName The name of the location. - * @param nameAvailabilityRequest The required parameters for checking if server name is available. + * @param nameAvailabilityRequest The required parameters for checking if resource 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 resource name availability. */ @ServiceMethod(returns = ReturnType.SINGLE) - public NameAvailabilityInner execute(String locationName, NameAvailabilityRequest nameAvailabilityRequest) { - return executeAsync(locationName, nameAvailabilityRequest).block(); + public NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest) { + return executeAsync(nameAvailabilityRequest).block(); } /** - * Check the availability of name for server. + * Check the availability of name for resource. * - * @param locationName The name of the location. - * @param nameAvailabilityRequest The required parameters for checking if server name is available. + * @param nameAvailabilityRequest The required parameters for checking if resource 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. @@ -224,7 +201,7 @@ public NameAvailabilityInner execute(String locationName, NameAvailabilityReques */ @ServiceMethod(returns = ReturnType.SINGLE) public Response executeWithResponse( - String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context) { - return executeWithResponseAsync(locationName, nameAvailabilityRequest, context).block(); + NameAvailabilityRequest nameAvailabilityRequest, Context context) { + return executeWithResponseAsync(nameAvailabilityRequest, context).block(); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java index bbde6771b03b2..114794962aa8f 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java @@ -28,8 +28,8 @@ public CheckNameAvailabilitiesImpl( this.serviceManager = serviceManager; } - public NameAvailability execute(String locationName, NameAvailabilityRequest nameAvailabilityRequest) { - NameAvailabilityInner inner = this.serviceClient().execute(locationName, nameAvailabilityRequest); + public NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest) { + NameAvailabilityInner inner = this.serviceClient().execute(nameAvailabilityRequest); if (inner != null) { return new NameAvailabilityImpl(inner, this.manager()); } else { @@ -38,9 +38,9 @@ public NameAvailability execute(String locationName, NameAvailabilityRequest nam } public Response executeWithResponse( - String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context) { + NameAvailabilityRequest nameAvailabilityRequest, Context context) { Response inner = - this.serviceClient().executeWithResponse(locationName, nameAvailabilityRequest, context); + this.serviceClient().executeWithResponse(nameAvailabilityRequest, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckVirtualNetworkSubnetUsagesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckVirtualNetworkSubnetUsagesImpl.java deleted file mode 100644 index 37b7a758b93d2..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckVirtualNetworkSubnetUsagesImpl.java +++ /dev/null @@ -1,62 +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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.CheckVirtualNetworkSubnetUsagesClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.CheckVirtualNetworkSubnetUsages; -import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; -import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkSubnetUsageResult; - -public final class CheckVirtualNetworkSubnetUsagesImpl implements CheckVirtualNetworkSubnetUsages { - private static final ClientLogger LOGGER = new ClientLogger(CheckVirtualNetworkSubnetUsagesImpl.class); - - private final CheckVirtualNetworkSubnetUsagesClient innerClient; - - private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - - public CheckVirtualNetworkSubnetUsagesImpl( - CheckVirtualNetworkSubnetUsagesClient innerClient, - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public VirtualNetworkSubnetUsageResult execute(String locationName, VirtualNetworkSubnetUsageParameter parameters) { - VirtualNetworkSubnetUsageResultInner inner = this.serviceClient().execute(locationName, parameters); - if (inner != null) { - return new VirtualNetworkSubnetUsageResultImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { - Response inner = - this.serviceClient().executeWithResponse(locationName, parameters, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new VirtualNetworkSubnetUsageResultImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - private CheckVirtualNetworkSubnetUsagesClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationImpl.java index b101069b493cc..20b70a4bfc876 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationImpl.java @@ -4,25 +4,15 @@ package com.azure.resourcemanager.mysqlflexibleserver.implementation; -import com.azure.core.management.SystemData; +import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner; import com.azure.resourcemanager.mysqlflexibleserver.models.Configuration; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationSource; -import com.azure.resourcemanager.mysqlflexibleserver.models.IsConfigPendingRestart; -import com.azure.resourcemanager.mysqlflexibleserver.models.IsDynamicConfig; -import com.azure.resourcemanager.mysqlflexibleserver.models.IsReadOnly; -public final class ConfigurationImpl implements Configuration { +public final class ConfigurationImpl implements Configuration, Configuration.Definition, Configuration.Update { private ConfigurationInner innerObject; private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - ConfigurationImpl( - ConfigurationInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - public String id() { return this.innerModel().id(); } @@ -35,10 +25,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String value() { return this.innerModel().value(); } @@ -59,20 +45,12 @@ public String allowedValues() { return this.innerModel().allowedValues(); } - public ConfigurationSource source() { + public String source() { return this.innerModel().source(); } - public IsReadOnly isReadOnly() { - return this.innerModel().isReadOnly(); - } - - public IsConfigPendingRestart isConfigPendingRestart() { - return this.innerModel().isConfigPendingRestart(); - } - - public IsDynamicConfig isDynamicConfig() { - return this.innerModel().isDynamicConfig(); + public String resourceGroupName() { + return resourceGroupName; } public ConfigurationInner innerModel() { @@ -82,4 +60,101 @@ public ConfigurationInner innerModel() { private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { return this.serviceManager; } + + private String resourceGroupName; + + private String serverName; + + private String configurationName; + + public ConfigurationImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public Configuration create() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public Configuration create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), context); + return this; + } + + ConfigurationImpl(String name, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = new ConfigurationInner(); + this.serviceManager = serviceManager; + this.configurationName = name; + } + + public ConfigurationImpl update() { + return this; + } + + public Configuration apply() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public Configuration apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), context); + return this; + } + + ConfigurationImpl( + ConfigurationInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.configurationName = Utils.getValueFromIdByName(innerObject.id(), "configurations"); + } + + public Configuration refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .getWithResponse(resourceGroupName, serverName, configurationName, Context.NONE) + .getValue(); + return this; + } + + public Configuration refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .getWithResponse(resourceGroupName, serverName, configurationName, context) + .getValue(); + return this; + } + + public ConfigurationImpl withValue(String value) { + this.innerModel().withValue(value); + return this; + } + + public ConfigurationImpl withSource(String source) { + this.innerModel().withSource(source); + return this; + } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationListResultImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationListResultImpl.java index e6ada232e096c..edea6408488d9 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationListResultImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationListResultImpl.java @@ -38,10 +38,6 @@ public List value() { } } - public String nextLink() { - return this.innerModel().nextLink(); - } - public ConfigurationListResultInner innerModel() { return this.innerObject; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationsClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationsClientImpl.java index bccfb8b83e498..3280460fa3427 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationsClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationsClientImpl.java @@ -11,9 +11,8 @@ import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceInterface; @@ -34,7 +33,6 @@ import com.azure.resourcemanager.mysqlflexibleserver.fluent.ConfigurationsClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationListForBatchUpdate; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -66,12 +64,12 @@ public final class ConfigurationsClientImpl implements ConfigurationsClient { @ServiceInterface(name = "MySqlManagementClien") private interface ConfigurationsService { @Headers({"Content-Type: application/json"}) - @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/configurations/{configurationName}") + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/configurations/{configurationName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> update( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -84,8 +82,8 @@ Mono>> update( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/configurations/{configurationName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/configurations/{configurationName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -98,26 +96,10 @@ Mono> get( @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/updateConfigurations") - @ExpectedResponses({200, 202}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> batchUpdate( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("serverName") String serverName, - @BodyParam("application/json") ConfigurationListForBatchUpdate parameters, - @HeaderParam("Accept") String accept, - Context context); - @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/configurations") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/configurations") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer( @@ -128,16 +110,6 @@ Mono> listByServer( @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); } /** @@ -153,7 +125,7 @@ Mono> listByServerNext( * @return represents a Configuration along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { if (this.client.getEndpoint() == null) { return Mono @@ -183,14 +155,15 @@ private Mono>> updateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .update( + .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -215,7 +188,7 @@ private Mono>> updateWithResponseAsync( * @return represents a Configuration along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String serverName, String configurationName, @@ -249,12 +222,13 @@ private Mono>> updateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .update( + .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -277,10 +251,10 @@ private Mono>> updateWithResponseAsync( * @return the {@link PollerFlux} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ConfigurationInner> beginUpdateAsync( + private PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { Mono>> mono = - updateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters); + createOrUpdateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters); return this .client .getLroResult( @@ -305,7 +279,7 @@ private PollerFlux, ConfigurationInner> beginUpda * @return the {@link PollerFlux} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ConfigurationInner> beginUpdateAsync( + private PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, String configurationName, @@ -313,7 +287,7 @@ private PollerFlux, ConfigurationInner> beginUpda Context context) { context = this.client.mergeContext(context); Mono>> mono = - updateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters, context); + createOrUpdateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters, context); return this .client .getLroResult( @@ -333,9 +307,9 @@ private PollerFlux, ConfigurationInner> beginUpda * @return the {@link SyncPoller} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ConfigurationInner> beginUpdate( + public SyncPoller, ConfigurationInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); } /** @@ -352,13 +326,14 @@ public SyncPoller, ConfigurationInner> beginUpdat * @return the {@link SyncPoller} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ConfigurationInner> beginUpdate( + public SyncPoller, ConfigurationInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters, Context context) { - return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context).getSyncPoller(); + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) + .getSyncPoller(); } /** @@ -374,9 +349,9 @@ public SyncPoller, ConfigurationInner> beginUpdat * @return represents a Configuration on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync( + private Mono createOrUpdateAsync( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters) + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); } @@ -395,13 +370,13 @@ private Mono updateAsync( * @return represents a Configuration on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync( + private Mono createOrUpdateAsync( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters, Context context) { - return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); } @@ -419,9 +394,9 @@ private Mono updateAsync( * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner update( + public ConfigurationInner createOrUpdate( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return updateAsync(resourceGroupName, serverName, configurationName, parameters).block(); + return createOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).block(); } /** @@ -438,13 +413,13 @@ public ConfigurationInner update( * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner update( + public ConfigurationInner createOrUpdate( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters, Context context) { - return updateAsync(resourceGroupName, serverName, configurationName, parameters, context).block(); + return createOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context).block(); } /** @@ -485,6 +460,7 @@ private Mono> getWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -492,7 +468,7 @@ private Mono> getWithResponseAsync( service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -541,12 +517,13 @@ private Mono> getWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -569,14 +546,7 @@ private Mono> getWithResponseAsync( @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String resourceGroupName, String serverName, String configurationName) { return getWithResponseAsync(resourceGroupName, serverName, configurationName) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -613,276 +583,6 @@ public Response getWithResponse( return getWithResponseAsync(resourceGroupName, serverName, configurationName, context).block(); } - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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 server configurations along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> batchUpdateWithResponseAsync( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate 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 - .batchUpdate( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - parameters, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @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 server configurations along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> batchUpdateWithResponseAsync( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate 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 - .batchUpdate( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - parameters, - accept, - context); - } - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 a list of server configurations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ConfigurationListResultInner> beginBatchUpdateAsync( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters) { - Mono>> mono = batchUpdateWithResponseAsync(resourceGroupName, serverName, parameters); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - ConfigurationListResultInner.class, - ConfigurationListResultInner.class, - this.client.getContext()); - } - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @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 a list of server configurations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ConfigurationListResultInner> beginBatchUpdateAsync( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = - batchUpdateWithResponseAsync(resourceGroupName, serverName, parameters, context); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - ConfigurationListResultInner.class, - ConfigurationListResultInner.class, - context); - } - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 a list of server configurations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ConfigurationListResultInner> beginBatchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters) { - return beginBatchUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); - } - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @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 a list of server configurations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ConfigurationListResultInner> beginBatchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context) { - return beginBatchUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); - } - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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 server configurations on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono batchUpdateAsync( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters) { - return beginBatchUpdateAsync(resourceGroupName, serverName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @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 server configurations on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono batchUpdateAsync( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context) { - return beginBatchUpdateAsync(resourceGroupName, serverName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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 server configurations. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationListResultInner batchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters) { - return batchUpdateAsync(resourceGroupName, serverName, parameters).block(); - } - - /** - * Update a list of configurations 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 parameters The parameters for updating a list of server configuration. - * @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 server configurations. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationListResultInner batchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context) { - return batchUpdateAsync(resourceGroupName, serverName, parameters, context).block(); - } - /** * List all the configurations in a given server. * @@ -916,6 +616,7 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -923,7 +624,7 @@ private Mono> listByServerSinglePageAsync( service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -932,12 +633,7 @@ private Mono> listByServerSinglePageAsync( .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -975,12 +671,13 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -989,12 +686,7 @@ private Mono> listByServerSinglePageAsync( .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -1009,9 +701,7 @@ private Mono> listByServerSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName), - nextLink -> listByServerNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** @@ -1028,9 +718,7 @@ private PagedFlux listByServerAsync(String resourceGroupName @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync( String resourceGroupName, String serverName, Context context) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), - nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** @@ -1064,77 +752,4 @@ 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 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 server configurations 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 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 server configurations 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationsImpl.java index 288a05bd4ace4..5991b7ae44bc1 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationsImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ConfigurationsImpl.java @@ -11,10 +11,7 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.mysqlflexibleserver.fluent.ConfigurationsClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; import com.azure.resourcemanager.mysqlflexibleserver.models.Configuration; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationListForBatchUpdate; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationListResult; import com.azure.resourcemanager.mysqlflexibleserver.models.Configurations; public final class ConfigurationsImpl implements Configurations { @@ -30,32 +27,6 @@ public ConfigurationsImpl( this.serviceManager = serviceManager; } - public Configuration update( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - ConfigurationInner inner = - this.serviceClient().update(resourceGroupName, serverName, configurationName, parameters); - if (inner != null) { - return new ConfigurationImpl(inner, this.manager()); - } else { - return null; - } - } - - public Configuration update( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - ConfigurationInner inner = - this.serviceClient().update(resourceGroupName, serverName, configurationName, parameters, context); - if (inner != null) { - return new ConfigurationImpl(inner, this.manager()); - } else { - return null; - } - } - public Configuration get(String resourceGroupName, String serverName, String configurationName) { ConfigurationInner inner = this.serviceClient().get(resourceGroupName, serverName, configurationName); if (inner != null) { @@ -80,28 +51,6 @@ public Response getWithResponse( } } - public ConfigurationListResult batchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters) { - ConfigurationListResultInner inner = - this.serviceClient().batchUpdate(resourceGroupName, serverName, parameters); - if (inner != null) { - return new ConfigurationListResultImpl(inner, this.manager()); - } else { - return null; - } - } - - public ConfigurationListResult batchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context) { - ConfigurationListResultInner inner = - this.serviceClient().batchUpdate(resourceGroupName, serverName, parameters, context); - if (inner != null) { - return new ConfigurationListResultImpl(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 ConfigurationImpl(inner1, this.manager())); @@ -113,6 +62,60 @@ public PagedIterable listByServer(String resourceGroupName, Strin return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager())); } + public Configuration getById(String 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "configurations"); + if (configurationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'configurations'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, configurationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "configurations"); + if (configurationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'configurations'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, configurationName, context); + } + private ConfigurationsClient serviceClient() { return this.innerClient; } @@ -120,4 +123,8 @@ private ConfigurationsClient serviceClient() { private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { return this.serviceManager; } + + public ConfigurationImpl define(String name) { + return new ConfigurationImpl(name, this.manager()); + } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabaseImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabaseImpl.java index cef28d0b6a14e..a8563a8b0f56c 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabaseImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabaseImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.mysqlflexibleserver.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.DatabaseInner; import com.azure.resourcemanager.mysqlflexibleserver.models.Database; @@ -26,10 +25,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String charset() { return this.innerModel().charset(); } @@ -38,6 +33,10 @@ public String collation() { return this.innerModel().collation(); } + public String resourceGroupName() { + return resourceGroupName; + } + public DatabaseInner innerModel() { return this.innerObject; } @@ -52,7 +51,7 @@ private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { private String databaseName; - public DatabaseImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { this.resourceGroupName = resourceGroupName; this.serverName = serverName; return this; @@ -108,7 +107,7 @@ public Database apply(Context context) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.serverName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabasesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabasesClientImpl.java index 3ece650d75b94..2f0a9c1c34a90 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabasesClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabasesClientImpl.java @@ -66,8 +66,8 @@ public final class DatabasesClientImpl implements DatabasesClient { private interface DatabasesService { @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/databases/{databaseName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/databases/{databaseName}") @ExpectedResponses({200, 201, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate( @@ -83,8 +83,8 @@ Mono>> createOrUpdate( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/databases/{databaseName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/databases/{databaseName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -99,8 +99,8 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/databases/{databaseName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/databases/{databaseName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -115,8 +115,8 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/databases") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/databases") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer( @@ -127,16 +127,6 @@ Mono> listByServer( @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); } /** @@ -181,6 +171,7 @@ private Mono>> createOrUpdateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -188,7 +179,7 @@ private Mono>> createOrUpdateWithResponseAsync( service .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -242,12 +233,13 @@ private Mono>> createOrUpdateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -461,6 +453,7 @@ private Mono>> deleteWithResponseAsync( if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -468,7 +461,7 @@ private Mono>> deleteWithResponseAsync( service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -515,12 +508,13 @@ private Mono>> deleteWithResponseAsync( if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -712,6 +706,7 @@ private Mono> getWithResponseAsync( if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -719,7 +714,7 @@ private Mono> getWithResponseAsync( service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -766,12 +761,13 @@ private Mono> getWithResponseAsync( if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -794,14 +790,7 @@ private Mono> getWithResponseAsync( @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithResponseAsync(resourceGroupName, serverName, databaseName) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -870,6 +859,7 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -877,7 +867,7 @@ private Mono> listByServerSinglePageAsync( service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -886,12 +876,7 @@ private Mono> listByServerSinglePageAsync( .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -928,12 +913,13 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -942,12 +928,7 @@ private Mono> listByServerSinglePageAsync( .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -962,9 +943,7 @@ private Mono> listByServerSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName), - nextLink -> listByServerNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** @@ -980,9 +959,7 @@ private PagedFlux listByServerAsync(String resourceGroupName, Str */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), - nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** @@ -1015,75 +992,4 @@ public PagedIterable listByServer(String resourceGroupName, Strin 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 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 databases 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 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 databases 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabasesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabasesImpl.java index cd20c10bb2613..4a53b4d200ac2 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabasesImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/DatabasesImpl.java @@ -78,13 +78,12 @@ public Database getById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String databaseName = Utils.getValueFromIdByName(id, "databases"); if (databaseName == null) { @@ -105,13 +104,12 @@ public Response getByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String databaseName = Utils.getValueFromIdByName(id, "databases"); if (databaseName == null) { @@ -132,13 +130,12 @@ public void deleteById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String databaseName = Utils.getValueFromIdByName(id, "databases"); if (databaseName == null) { @@ -159,13 +156,12 @@ public void deleteByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String databaseName = Utils.getValueFromIdByName(id, "databases"); if (databaseName == null) { diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRuleImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRuleImpl.java index 607c4c18ed3c3..f34f3c4c87d2e 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRuleImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRuleImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.mysqlflexibleserver.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.FirewallRuleInner; import com.azure.resourcemanager.mysqlflexibleserver.models.FirewallRule; @@ -26,10 +25,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String startIpAddress() { return this.innerModel().startIpAddress(); } @@ -38,6 +33,10 @@ public String endIpAddress() { return this.innerModel().endIpAddress(); } + public String resourceGroupName() { + return resourceGroupName; + } + public FirewallRuleInner innerModel() { return this.innerObject; } @@ -52,7 +51,7 @@ private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { private String firewallRuleName; - public FirewallRuleImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + public FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { this.resourceGroupName = resourceGroupName; this.serverName = serverName; return this; @@ -109,7 +108,7 @@ public FirewallRule apply(Context context) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.serverName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "firewallRules"); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRulesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRulesClientImpl.java index 018b1554a04c7..079c5d3cb3e74 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRulesClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRulesClientImpl.java @@ -66,8 +66,8 @@ public final class FirewallRulesClientImpl implements FirewallRulesClient { private interface FirewallRulesService { @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({200, 201, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate( @@ -83,8 +83,8 @@ Mono>> createOrUpdate( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -99,8 +99,8 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -115,8 +115,8 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/firewallRules") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/firewallRules") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer( @@ -127,16 +127,6 @@ Mono> listByServer( @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); } /** @@ -182,6 +172,7 @@ private Mono>> createOrUpdateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -189,7 +180,7 @@ private Mono>> createOrUpdateWithResponseAsync( service .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -248,12 +239,13 @@ private Mono>> createOrUpdateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -448,7 +440,7 @@ public FirewallRuleInner createOrUpdate( } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -484,6 +476,7 @@ private Mono>> deleteWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -491,7 +484,7 @@ private Mono>> deleteWithResponseAsync( service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -502,7 +495,7 @@ private Mono>> deleteWithResponseAsync( } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -539,12 +532,13 @@ private Mono>> deleteWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -554,7 +548,7 @@ private Mono>> deleteWithResponseAsync( } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -576,7 +570,7 @@ private PollerFlux, Void> beginDeleteAsync( } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -599,7 +593,7 @@ private PollerFlux, Void> beginDeleteAsync( } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -616,7 +610,7 @@ public SyncPoller, Void> beginDelete( } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -634,7 +628,7 @@ public SyncPoller, Void> beginDelete( } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -652,7 +646,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Stri } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -672,7 +666,7 @@ private Mono deleteAsync( } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -687,7 +681,7 @@ public void delete(String resourceGroupName, String serverName, String firewallR } /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -740,6 +734,7 @@ private Mono> getWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -747,7 +742,7 @@ private Mono> getWithResponseAsync( service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -796,12 +791,13 @@ private Mono> getWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -824,14 +820,7 @@ private Mono> getWithResponseAsync( @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String resourceGroupName, String serverName, String firewallRuleName) { return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -900,6 +889,7 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -907,7 +897,7 @@ private Mono> listByServerSinglePageAsync( service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -916,12 +906,7 @@ private Mono> listByServerSinglePageAsync( .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -958,12 +943,13 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -972,12 +958,7 @@ private Mono> listByServerSinglePageAsync( .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -992,9 +973,7 @@ private Mono> listByServerSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName), - nextLink -> listByServerNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** @@ -1011,9 +990,7 @@ private PagedFlux listByServerAsync(String resourceGroupName, @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync( String resourceGroupName, String serverName, Context context) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), - nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** @@ -1046,75 +1023,4 @@ public PagedIterable listByServer(String resourceGroupName, S 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 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 firewall rules 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 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 firewall rules 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRulesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRulesImpl.java index da5a1b2a074fe..1d21d4158584b 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRulesImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/FirewallRulesImpl.java @@ -79,13 +79,12 @@ public FirewallRule getById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { @@ -106,13 +105,12 @@ public Response getByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { @@ -133,13 +131,12 @@ public void deleteById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { @@ -160,13 +157,12 @@ public void deleteByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java deleted file mode 100644 index f696c85049acc..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java +++ /dev/null @@ -1,157 +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.mysqlflexibleserver.implementation; - -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.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.mysqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.GetPrivateDnsZoneSuffixResponseInner; -import reactor.core.publisher.Mono; - -/** An instance of this class provides access to all the operations defined in GetPrivateDnsZoneSuffixesClient. */ -public final class GetPrivateDnsZoneSuffixesClientImpl implements GetPrivateDnsZoneSuffixesClient { - /** The proxy service used to perform REST calls. */ - private final GetPrivateDnsZoneSuffixesService service; - - /** The service client containing this operation class. */ - private final MySqlManagementClientImpl client; - - /** - * Initializes an instance of GetPrivateDnsZoneSuffixesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - GetPrivateDnsZoneSuffixesClientImpl(MySqlManagementClientImpl client) { - this.service = - RestProxy - .create( - GetPrivateDnsZoneSuffixesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for MySqlManagementClientGetPrivateDnsZoneSuffixes to be used by the - * proxy service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "MySqlManagementClien") - private interface GetPrivateDnsZoneSuffixesService { - @Headers({"Content-Type: application/json"}) - @Post("/providers/Microsoft.DBforMySQL/getPrivateDnsZoneSuffix") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> execute( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return private DNS zone suffix in the cloud along with {@link Response} on successful completion of {@link - * Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync() { - 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.execute(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @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 private DNS zone suffix in the cloud along with {@link Response} on successful completion of {@link - * Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.execute(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return private DNS zone suffix in the cloud on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono executeAsync() { - return executeWithResponseAsync() - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return private DNS zone suffix in the cloud. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public GetPrivateDnsZoneSuffixResponseInner execute() { - return executeAsync().block(); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @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 private DNS zone suffix in the cloud along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response executeWithResponse(Context context) { - return executeWithResponseAsync(context).block(); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java deleted file mode 100644 index 8d01cb74c9314..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java +++ /dev/null @@ -1,46 +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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.LocationBasedCapabilitiesClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.CapabilityProperties; -import com.azure.resourcemanager.mysqlflexibleserver.models.LocationBasedCapabilities; - -public final class LocationBasedCapabilitiesImpl implements LocationBasedCapabilities { - private static final ClientLogger LOGGER = new ClientLogger(LocationBasedCapabilitiesImpl.class); - - private final LocationBasedCapabilitiesClient innerClient; - - private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - - public LocationBasedCapabilitiesImpl( - LocationBasedCapabilitiesClient innerClient, - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list(String locationName) { - PagedIterable inner = this.serviceClient().list(locationName); - return Utils.mapPage(inner, inner1 -> new CapabilityPropertiesImpl(inner1, this.manager())); - } - - public PagedIterable list(String locationName, Context context) { - PagedIterable inner = this.serviceClient().list(locationName, context); - return Utils.mapPage(inner, inner1 -> new CapabilityPropertiesImpl(inner1, this.manager())); - } - - private LocationBasedCapabilitiesClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedPerformanceTiersClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedPerformanceTiersClientImpl.java new file mode 100644 index 0000000000000..5c56e6439135d --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedPerformanceTiersClientImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PerformanceTierListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LocationBasedPerformanceTiersClient. */ +public final class LocationBasedPerformanceTiersClientImpl implements LocationBasedPerformanceTiersClient { + /** The proxy service used to perform REST calls. */ + private final LocationBasedPerformanceTiersService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of LocationBasedPerformanceTiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationBasedPerformanceTiersClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy + .create( + LocationBasedPerformanceTiersService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientLocationBasedPerformanceTiers to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface LocationBasedPerformanceTiersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/performanceTiers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 performance tiers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String locationName) { + 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + locationName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @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 performance tiers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String locationName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), locationName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 performance tiers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName) { + return new PagedFlux<>(() -> listSinglePageAsync(locationName)); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @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 performance tiers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(locationName, context)); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 performance tiers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName) { + return new PagedIterable<>(listAsync(locationName)); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @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 performance tiers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName, Context context) { + return new PagedIterable<>(listAsync(locationName, context)); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedPerformanceTiersImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedPerformanceTiersImpl.java new file mode 100644 index 0000000000000..8083492ee63b5 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedPerformanceTiersImpl.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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.LocationBasedPerformanceTiers; +import com.azure.resourcemanager.mysqlflexibleserver.models.PerformanceTierProperties; + +public final class LocationBasedPerformanceTiersImpl implements LocationBasedPerformanceTiers { + private static final ClientLogger LOGGER = new ClientLogger(LocationBasedPerformanceTiersImpl.class); + + private final LocationBasedPerformanceTiersClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public LocationBasedPerformanceTiersImpl( + LocationBasedPerformanceTiersClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String locationName) { + PagedIterable inner = this.serviceClient().list(locationName); + return Utils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable list(String locationName, Context context) { + PagedIterable inner = this.serviceClient().list(locationName, context); + return Utils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + } + + private LocationBasedPerformanceTiersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckVirtualNetworkSubnetUsagesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsOperationStatusClientImpl.java similarity index 59% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckVirtualNetworkSubnetUsagesClientImpl.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsOperationStatusClientImpl.java index 68628c5d4f335..8329c82029f7c 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/CheckVirtualNetworkSubnetUsagesClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsOperationStatusClientImpl.java @@ -4,14 +4,13 @@ package com.azure.resourcemanager.mysqlflexibleserver.implementation; -import com.azure.core.annotation.BodyParam; 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.Post; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceInterface; @@ -22,71 +21,75 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.CheckVirtualNetworkSubnetUsagesClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.LocationBasedRecommendedActionSessionsOperationStatusClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendedActionSessionsOperationStatusInner; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in CheckVirtualNetworkSubnetUsagesClient. */ -public final class CheckVirtualNetworkSubnetUsagesClientImpl implements CheckVirtualNetworkSubnetUsagesClient { +/** + * An instance of this class provides access to all the operations defined in + * LocationBasedRecommendedActionSessionsOperationStatusClient. + */ +public final class LocationBasedRecommendedActionSessionsOperationStatusClientImpl + implements LocationBasedRecommendedActionSessionsOperationStatusClient { /** The proxy service used to perform REST calls. */ - private final CheckVirtualNetworkSubnetUsagesService service; + private final LocationBasedRecommendedActionSessionsOperationStatusService service; /** The service client containing this operation class. */ private final MySqlManagementClientImpl client; /** - * Initializes an instance of CheckVirtualNetworkSubnetUsagesClientImpl. + * Initializes an instance of LocationBasedRecommendedActionSessionsOperationStatusClientImpl. * * @param client the instance of the service client containing this operation class. */ - CheckVirtualNetworkSubnetUsagesClientImpl(MySqlManagementClientImpl client) { + LocationBasedRecommendedActionSessionsOperationStatusClientImpl(MySqlManagementClientImpl client) { this.service = RestProxy .create( - CheckVirtualNetworkSubnetUsagesService.class, + LocationBasedRecommendedActionSessionsOperationStatusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for MySqlManagementClientCheckVirtualNetworkSubnetUsages to be used by - * the proxy service to perform REST calls. + * The interface defining all the services for + * MySqlManagementClientLocationBasedRecommendedActionSessionsOperationStatus to be used by the proxy service to + * perform REST calls. */ @Host("{$host}") @ServiceInterface(name = "MySqlManagementClien") - private interface CheckVirtualNetworkSubnetUsagesService { + private interface LocationBasedRecommendedActionSessionsOperationStatusService { @Headers({"Content-Type: application/json"}) - @Post( + @Get( "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}" - + "/checkVirtualNetworkSubnetUsage") + + "/recommendedActionSessionsAzureAsyncOperation/{operationId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> execute( + Mono> get( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("locationName") String locationName, - @BodyParam("application/json") VirtualNetworkSubnetUsageParameter parameters, + @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept, Context context); } /** - * Get virtual network subnet usage for a given vNet resource id. + * Recommendation action session operation status. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param operationId The operation identifier. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return virtual network subnet usage for a given vNet resource id along with {@link Response} on successful - * completion of {@link Mono}. + * @return recommendation action session operation status along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync( - String locationName, VirtualNetworkSubnetUsageParameter parameters) { + private Mono> getWithResponseAsync( + String locationName, String operationId) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -102,42 +105,41 @@ private Mono> executeWithResponse if (locationName == null) { return Mono.error(new IllegalArgumentException("Parameter locationName 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(); + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); } + final String apiVersion = "2018-06-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .execute( + .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), locationName, - parameters, + operationId, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get virtual network subnet usage for a given vNet resource id. + * Recommendation action session operation status. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param operationId The operation identifier. * @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 virtual network subnet usage for a given vNet resource id along with {@link Response} on successful - * completion of {@link Mono}. + * @return recommendation action session operation status along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { + private Mono> getWithResponseAsync( + String locationName, String operationId, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -153,78 +155,67 @@ private Mono> executeWithResponse if (locationName == null) { return Mono.error(new IllegalArgumentException("Parameter locationName 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(); + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); } + final String apiVersion = "2018-06-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .execute( + .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), locationName, - parameters, + operationId, accept, context); } /** - * Get virtual network subnet usage for a given vNet resource id. + * Recommendation action session operation status. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param operationId The operation identifier. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return virtual network subnet usage for a given vNet resource id on successful completion of {@link Mono}. + * @return recommendation action session operation status on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono executeAsync( - String locationName, VirtualNetworkSubnetUsageParameter parameters) { - return executeWithResponseAsync(locationName, parameters) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + private Mono getAsync(String locationName, String operationId) { + return getWithResponseAsync(locationName, operationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Get virtual network subnet usage for a given vNet resource id. + * Recommendation action session operation status. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param operationId The operation identifier. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return virtual network subnet usage for a given vNet resource id. + * @return recommendation action session operation status. */ @ServiceMethod(returns = ReturnType.SINGLE) - public VirtualNetworkSubnetUsageResultInner execute( - String locationName, VirtualNetworkSubnetUsageParameter parameters) { - return executeAsync(locationName, parameters).block(); + public RecommendedActionSessionsOperationStatusInner get(String locationName, String operationId) { + return getAsync(locationName, operationId).block(); } /** - * Get virtual network subnet usage for a given vNet resource id. + * Recommendation action session operation status. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param operationId The operation identifier. * @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 virtual network subnet usage for a given vNet resource id along with {@link Response}. + * @return recommendation action session operation status along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { - return executeWithResponseAsync(locationName, parameters, context).block(); + public Response getWithResponse( + String locationName, String operationId, Context context) { + return getWithResponseAsync(locationName, operationId, context).block(); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsOperationStatusImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsOperationStatusImpl.java new file mode 100644 index 0000000000000..c206e1d05e1cc --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsOperationStatusImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.LocationBasedRecommendedActionSessionsOperationStatusClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendedActionSessionsOperationStatusInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.LocationBasedRecommendedActionSessionsOperationStatus; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecommendedActionSessionsOperationStatus; + +public final class LocationBasedRecommendedActionSessionsOperationStatusImpl + implements LocationBasedRecommendedActionSessionsOperationStatus { + private static final ClientLogger LOGGER = + new ClientLogger(LocationBasedRecommendedActionSessionsOperationStatusImpl.class); + + private final LocationBasedRecommendedActionSessionsOperationStatusClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public LocationBasedRecommendedActionSessionsOperationStatusImpl( + LocationBasedRecommendedActionSessionsOperationStatusClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RecommendedActionSessionsOperationStatus get(String locationName, String operationId) { + RecommendedActionSessionsOperationStatusInner inner = this.serviceClient().get(locationName, operationId); + if (inner != null) { + return new RecommendedActionSessionsOperationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String locationName, String operationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(locationName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecommendedActionSessionsOperationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private LocationBasedRecommendedActionSessionsOperationStatusClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsResultsClientImpl.java similarity index 68% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsResultsClientImpl.java index b02828f4e91c4..d9d0f9527acb8 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsResultsClientImpl.java @@ -25,56 +25,65 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.LocationBasedCapabilitiesClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.CapabilitiesListResult; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.LocationBasedRecommendedActionSessionsResultsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecommendationActionsResultList; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in LocationBasedCapabilitiesClient. */ -public final class LocationBasedCapabilitiesClientImpl implements LocationBasedCapabilitiesClient { +/** + * An instance of this class provides access to all the operations defined in + * LocationBasedRecommendedActionSessionsResultsClient. + */ +public final class LocationBasedRecommendedActionSessionsResultsClientImpl + implements LocationBasedRecommendedActionSessionsResultsClient { /** The proxy service used to perform REST calls. */ - private final LocationBasedCapabilitiesService service; + private final LocationBasedRecommendedActionSessionsResultsService service; /** The service client containing this operation class. */ private final MySqlManagementClientImpl client; /** - * Initializes an instance of LocationBasedCapabilitiesClientImpl. + * Initializes an instance of LocationBasedRecommendedActionSessionsResultsClientImpl. * * @param client the instance of the service client containing this operation class. */ - LocationBasedCapabilitiesClientImpl(MySqlManagementClientImpl client) { + LocationBasedRecommendedActionSessionsResultsClientImpl(MySqlManagementClientImpl client) { this.service = RestProxy .create( - LocationBasedCapabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + LocationBasedRecommendedActionSessionsResultsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for MySqlManagementClientLocationBasedCapabilities to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for MySqlManagementClientLocationBasedRecommendedActionSessionsResults to + * be used by the proxy service to perform REST calls. */ @Host("{$host}") @ServiceInterface(name = "MySqlManagementClien") - private interface LocationBasedCapabilitiesService { + private interface LocationBasedRecommendedActionSessionsResultsService { @Headers({"Content-Type: application/json"}) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilities") - @ExpectedResponses({200}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}" + + "/recommendedActionSessionsOperationResults/{operationId}") + @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( + Mono> list( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("locationName") String locationName, + @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( + Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, @@ -82,17 +91,19 @@ Mono> listNext( } /** - * Get capabilities at specified location in a given subscription. + * Recommendation action session operation result. * * @param locationName The name of the location. + * @param operationId The operation identifier. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 at specified location in a given subscription along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a list of recommendation actions along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String locationName) { + private Mono> listSinglePageAsync( + String locationName, String operationId) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -108,6 +119,10 @@ private Mono> listSinglePageAsync(Strin if (locationName == null) { return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -115,12 +130,13 @@ private Mono> listSinglePageAsync(Strin service .list( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), locationName, + operationId, accept, context)) - .>map( + .>map( res -> new PagedResponseBase<>( res.getRequest(), @@ -133,18 +149,20 @@ private Mono> listSinglePageAsync(Strin } /** - * Get capabilities at specified location in a given subscription. + * Recommendation action session operation result. * * @param locationName The name of the location. + * @param operationId The operation identifier. * @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 at specified location in a given subscription along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * @return a list of recommendation actions along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String locationName, Context context) { + private Mono> listSinglePageAsync( + String locationName, String operationId, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -160,14 +178,19 @@ private Mono> listSinglePageAsync(Strin if (locationName == null) { return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .list( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), locationName, + operationId, accept, context) .map( @@ -182,64 +205,68 @@ private Mono> listSinglePageAsync(Strin } /** - * Get capabilities at specified location in a given subscription. + * Recommendation action session operation result. * * @param locationName The name of the location. + * @param operationId The operation identifier. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 at specified location in a given subscription as paginated response with {@link PagedFlux}. + * @return a list of recommendation actions as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String locationName) { - return new PagedFlux<>(() -> listSinglePageAsync(locationName), nextLink -> listNextSinglePageAsync(nextLink)); + private PagedFlux listAsync(String locationName, String operationId) { + return new PagedFlux<>( + () -> listSinglePageAsync(locationName, operationId), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Get capabilities at specified location in a given subscription. + * Recommendation action session operation result. * * @param locationName The name of the location. + * @param operationId The operation identifier. * @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 at specified location in a given subscription as paginated response with {@link PagedFlux}. + * @return a list of recommendation actions as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String locationName, Context context) { + private PagedFlux listAsync(String locationName, String operationId, Context context) { return new PagedFlux<>( - () -> listSinglePageAsync(locationName, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + () -> listSinglePageAsync(locationName, operationId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Get capabilities at specified location in a given subscription. + * Recommendation action session operation result. * * @param locationName The name of the location. + * @param operationId The operation identifier. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 at specified location in a given subscription as paginated response with {@link - * PagedIterable}. + * @return a list of recommendation actions as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String locationName) { - return new PagedIterable<>(listAsync(locationName)); + public PagedIterable list(String locationName, String operationId) { + return new PagedIterable<>(listAsync(locationName, operationId)); } /** - * Get capabilities at specified location in a given subscription. + * Recommendation action session operation result. * * @param locationName The name of the location. + * @param operationId The operation identifier. * @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 at specified location in a given subscription as paginated response with {@link - * PagedIterable}. + * @return a list of recommendation actions as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String locationName, Context context) { - return new PagedIterable<>(listAsync(locationName, context)); + public PagedIterable list(String locationName, String operationId, Context context) { + return new PagedIterable<>(listAsync(locationName, operationId, context)); } /** @@ -249,10 +276,11 @@ public PagedIterable list(String locationName, Contex * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 a list of recommendation actions along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -265,7 +293,7 @@ private Mono> listNextSinglePageAsync(S final String accept = "application/json"; return FluxUtil .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( + .>map( res -> new PagedResponseBase<>( res.getRequest(), @@ -285,10 +313,11 @@ private Mono> listNextSinglePageAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return location capability along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of recommendation actions along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private Mono> listNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsResultsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsResultsImpl.java new file mode 100644 index 0000000000000..ac6786a683614 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LocationBasedRecommendedActionSessionsResultsImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.LocationBasedRecommendedActionSessionsResultsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.LocationBasedRecommendedActionSessionsResults; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecommendationAction; + +public final class LocationBasedRecommendedActionSessionsResultsImpl + implements LocationBasedRecommendedActionSessionsResults { + private static final ClientLogger LOGGER = + new ClientLogger(LocationBasedRecommendedActionSessionsResultsImpl.class); + + private final LocationBasedRecommendedActionSessionsResultsClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public LocationBasedRecommendedActionSessionsResultsImpl( + LocationBasedRecommendedActionSessionsResultsClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String locationName, String operationId) { + PagedIterable inner = this.serviceClient().list(locationName, operationId); + return Utils.mapPage(inner, inner1 -> new RecommendationActionImpl(inner1, this.manager())); + } + + public PagedIterable list(String locationName, String operationId, Context context) { + PagedIterable inner = this.serviceClient().list(locationName, operationId, context); + return Utils.mapPage(inner, inner1 -> new RecommendationActionImpl(inner1, this.manager())); + } + + private LocationBasedRecommendedActionSessionsResultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerBackupImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LogFileImpl.java similarity index 54% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerBackupImpl.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LogFileImpl.java index ca699a09753b0..9bf7aea38b45c 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerBackupImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LogFileImpl.java @@ -4,18 +4,16 @@ package com.azure.resourcemanager.mysqlflexibleserver.implementation; -import com.azure.core.management.SystemData; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerBackupInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerBackup; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.LogFile; import java.time.OffsetDateTime; -public final class ServerBackupImpl implements ServerBackup { - private ServerBackupInner innerObject; +public final class LogFileImpl implements LogFile { + private LogFileInner innerObject; private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - ServerBackupImpl( - ServerBackupInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + LogFileImpl(LogFileInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -32,23 +30,27 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); + public Long sizeInKB() { + return this.innerModel().sizeInKB(); } - public String backupType() { - return this.innerModel().backupType(); + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); } - public OffsetDateTime completedTime() { - return this.innerModel().completedTime(); + public OffsetDateTime lastModifiedTime() { + return this.innerModel().lastModifiedTime(); } - public String source() { - return this.innerModel().source(); + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); } - public ServerBackupInner innerModel() { + public String url() { + return this.innerModel().url(); + } + + public LogFileInner innerModel() { return this.innerObject; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LogFilesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LogFilesClientImpl.java new file mode 100644 index 0000000000000..5e9bff57cbb5f --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LogFilesClientImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.LogFilesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.mysqlflexibleserver.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 MySqlManagementClientImpl client; + + /** + * Initializes an instance of LogFilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LogFilesClientImpl(MySqlManagementClientImpl client) { + this.service = RestProxy.create(LogFilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientLogFiles to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface LogFilesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{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); + } + + /** + * List all the 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 log files 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the 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 log files 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the 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 log files as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the 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 log files 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)); + } + + /** + * List all the 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 log files 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 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 log files 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)); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LogFilesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LogFilesImpl.java new file mode 100644 index 0000000000000..55a9e2825b556 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/LogFilesImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.LogFilesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.LogFile; +import com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.MySqlManager serviceManager; + + public LogFilesImpl( + LogFilesClient innerClient, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/MySqlManagementClientBuilder.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/MySqlManagementClientBuilder.java index 3935654f88d7d..ba94ff4110b30 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/MySqlManagementClientBuilder.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/MySqlManagementClientBuilder.java @@ -7,7 +7,6 @@ import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.AzureEnvironment; @@ -67,34 +66,34 @@ public MySqlManagementClientBuilder environment(AzureEnvironment environment) { } /* - * The default poll interval for long-running operation + * The HTTP pipeline to send requests through */ - private Duration defaultPollInterval; + private HttpPipeline pipeline; /** - * Sets The default poll interval for long-running operation. + * Sets The HTTP pipeline to send requests through. * - * @param defaultPollInterval the defaultPollInterval value. + * @param pipeline the pipeline value. * @return the MySqlManagementClientBuilder. */ - public MySqlManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; + public MySqlManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; return this; } /* - * The HTTP pipeline to send requests through + * The default poll interval for long-running operation */ - private HttpPipeline pipeline; + private Duration defaultPollInterval; /** - * Sets The HTTP pipeline to send requests through. + * Sets The default poll interval for long-running operation. * - * @param pipeline the pipeline value. + * @param defaultPollInterval the defaultPollInterval value. * @return the MySqlManagementClientBuilder. */ - public MySqlManagementClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; + public MySqlManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; return this; } @@ -126,15 +125,12 @@ public MySqlManagementClientImpl buildClient() { if (environment == null) { this.environment = AzureEnvironment.AZURE; } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } if (defaultPollInterval == null) { this.defaultPollInterval = Duration.ofSeconds(30); } - if (pipeline == null) { - this.pipeline = - new HttpPipelineBuilder() - .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) - .build(); - } if (serializerAdapter == null) { this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/MySqlManagementClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/MySqlManagementClientImpl.java index 182cee1e8e485..ab1fa9ad65484 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/MySqlManagementClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/MySqlManagementClientImpl.java @@ -15,31 +15,46 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.BackupsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.AdvisorsClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.CheckNameAvailabilitiesClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.CheckVirtualNetworkSubnetUsagesClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.ConfigurationsClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.DatabasesClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.FirewallRulesClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.LocationBasedCapabilitiesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.LocationBasedRecommendedActionSessionsOperationStatusClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.LocationBasedRecommendedActionSessionsResultsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.LogFilesClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.MySqlManagementClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.OperationsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.QueryTextsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.RecommendedActionsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.RecoverableServersClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServerAdministratorsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServerKeysClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServerParametersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServerSecurityAlertPoliciesClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.TopQueryStatisticsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.WaitStatisticsClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.time.Duration; -import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -70,18 +85,6 @@ public String getEndpoint() { return this.endpoint; } - /** Api Version. */ - private final String apiVersion; - - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - /** The HTTP pipeline to send requests through. */ private final HttpPipeline httpPipeline; @@ -142,18 +145,6 @@ public ReplicasClient getReplicas() { return this.replicas; } - /** The BackupsClient object to access its operations. */ - private final BackupsClient backups; - - /** - * Gets the BackupsClient object to access its operations. - * - * @return the BackupsClient object. - */ - public BackupsClient getBackups() { - return this.backups; - } - /** The FirewallRulesClient object to access its operations. */ private final FirewallRulesClient firewallRules; @@ -166,6 +157,18 @@ public FirewallRulesClient getFirewallRules() { return this.firewallRules; } + /** The VirtualNetworkRulesClient object to access its operations. */ + private final VirtualNetworkRulesClient virtualNetworkRules; + + /** + * Gets the VirtualNetworkRulesClient object to access its operations. + * + * @return the VirtualNetworkRulesClient object. + */ + public VirtualNetworkRulesClient getVirtualNetworkRules() { + return this.virtualNetworkRules; + } + /** The DatabasesClient object to access its operations. */ private final DatabasesClient databases; @@ -190,52 +193,88 @@ public ConfigurationsClient getConfigurations() { return this.configurations; } - /** The LocationBasedCapabilitiesClient object to access its operations. */ - private final LocationBasedCapabilitiesClient locationBasedCapabilities; + /** The ServerParametersClient object to access its operations. */ + private final ServerParametersClient serverParameters; /** - * Gets the LocationBasedCapabilitiesClient object to access its operations. + * Gets the ServerParametersClient object to access its operations. * - * @return the LocationBasedCapabilitiesClient object. + * @return the ServerParametersClient object. */ - public LocationBasedCapabilitiesClient getLocationBasedCapabilities() { - return this.locationBasedCapabilities; + public ServerParametersClient getServerParameters() { + return this.serverParameters; } - /** The CheckVirtualNetworkSubnetUsagesClient object to access its operations. */ - private final CheckVirtualNetworkSubnetUsagesClient checkVirtualNetworkSubnetUsages; + /** The LogFilesClient object to access its operations. */ + private final LogFilesClient logFiles; /** - * Gets the CheckVirtualNetworkSubnetUsagesClient object to access its operations. + * Gets the LogFilesClient object to access its operations. * - * @return the CheckVirtualNetworkSubnetUsagesClient object. + * @return the LogFilesClient object. */ - public CheckVirtualNetworkSubnetUsagesClient getCheckVirtualNetworkSubnetUsages() { - return this.checkVirtualNetworkSubnetUsages; + public LogFilesClient getLogFiles() { + return this.logFiles; } - /** The CheckNameAvailabilitiesClient object to access its operations. */ - private final CheckNameAvailabilitiesClient checkNameAvailabilities; + /** The ServerAdministratorsClient object to access its operations. */ + private final ServerAdministratorsClient serverAdministrators; /** - * Gets the CheckNameAvailabilitiesClient object to access its operations. + * Gets the ServerAdministratorsClient object to access its operations. * - * @return the CheckNameAvailabilitiesClient object. + * @return the ServerAdministratorsClient object. */ - public CheckNameAvailabilitiesClient getCheckNameAvailabilities() { - return this.checkNameAvailabilities; + public ServerAdministratorsClient getServerAdministrators() { + return this.serverAdministrators; } - /** The GetPrivateDnsZoneSuffixesClient object to access its operations. */ - private final GetPrivateDnsZoneSuffixesClient getPrivateDnsZoneSuffixes; + /** The RecoverableServersClient object to access its operations. */ + private final RecoverableServersClient recoverableServers; /** - * Gets the GetPrivateDnsZoneSuffixesClient object to access its operations. + * Gets the RecoverableServersClient object to access its operations. * - * @return the GetPrivateDnsZoneSuffixesClient object. + * @return the RecoverableServersClient object. */ - public GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes() { - return this.getPrivateDnsZoneSuffixes; + public RecoverableServersClient getRecoverableServers() { + return this.recoverableServers; + } + + /** The ServerBasedPerformanceTiersClient object to access its operations. */ + private final ServerBasedPerformanceTiersClient serverBasedPerformanceTiers; + + /** + * Gets the ServerBasedPerformanceTiersClient object to access its operations. + * + * @return the ServerBasedPerformanceTiersClient object. + */ + public ServerBasedPerformanceTiersClient getServerBasedPerformanceTiers() { + return this.serverBasedPerformanceTiers; + } + + /** The LocationBasedPerformanceTiersClient object to access its operations. */ + private final LocationBasedPerformanceTiersClient locationBasedPerformanceTiers; + + /** + * Gets the LocationBasedPerformanceTiersClient object to access its operations. + * + * @return the LocationBasedPerformanceTiersClient object. + */ + public LocationBasedPerformanceTiersClient getLocationBasedPerformanceTiers() { + return this.locationBasedPerformanceTiers; + } + + /** The CheckNameAvailabilitiesClient object to access its operations. */ + private final CheckNameAvailabilitiesClient checkNameAvailabilities; + + /** + * Gets the CheckNameAvailabilitiesClient object to access its operations. + * + * @return the CheckNameAvailabilitiesClient object. + */ + public CheckNameAvailabilitiesClient getCheckNameAvailabilities() { + return this.checkNameAvailabilities; } /** The OperationsClient object to access its operations. */ @@ -250,6 +289,152 @@ public OperationsClient getOperations() { return this.operations; } + /** The ServerSecurityAlertPoliciesClient object to access its operations. */ + private final ServerSecurityAlertPoliciesClient serverSecurityAlertPolicies; + + /** + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ServerSecurityAlertPoliciesClient object. + */ + public ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies() { + return this.serverSecurityAlertPolicies; + } + + /** The QueryTextsClient object to access its operations. */ + private final QueryTextsClient queryTexts; + + /** + * Gets the QueryTextsClient object to access its operations. + * + * @return the QueryTextsClient object. + */ + public QueryTextsClient getQueryTexts() { + return this.queryTexts; + } + + /** The TopQueryStatisticsClient object to access its operations. */ + private final TopQueryStatisticsClient topQueryStatistics; + + /** + * Gets the TopQueryStatisticsClient object to access its operations. + * + * @return the TopQueryStatisticsClient object. + */ + public TopQueryStatisticsClient getTopQueryStatistics() { + return this.topQueryStatistics; + } + + /** The WaitStatisticsClient object to access its operations. */ + private final WaitStatisticsClient waitStatistics; + + /** + * Gets the WaitStatisticsClient object to access its operations. + * + * @return the WaitStatisticsClient object. + */ + public WaitStatisticsClient getWaitStatistics() { + return this.waitStatistics; + } + + /** 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 AdvisorsClient object to access its operations. */ + private final AdvisorsClient advisors; + + /** + * Gets the AdvisorsClient object to access its operations. + * + * @return the AdvisorsClient object. + */ + public AdvisorsClient getAdvisors() { + return this.advisors; + } + + /** The RecommendedActionsClient object to access its operations. */ + private final RecommendedActionsClient recommendedActions; + + /** + * Gets the RecommendedActionsClient object to access its operations. + * + * @return the RecommendedActionsClient object. + */ + public RecommendedActionsClient getRecommendedActions() { + return this.recommendedActions; + } + + /** The LocationBasedRecommendedActionSessionsOperationStatusClient object to access its operations. */ + private final LocationBasedRecommendedActionSessionsOperationStatusClient + locationBasedRecommendedActionSessionsOperationStatus; + + /** + * Gets the LocationBasedRecommendedActionSessionsOperationStatusClient object to access its operations. + * + * @return the LocationBasedRecommendedActionSessionsOperationStatusClient object. + */ + public LocationBasedRecommendedActionSessionsOperationStatusClient + getLocationBasedRecommendedActionSessionsOperationStatus() { + return this.locationBasedRecommendedActionSessionsOperationStatus; + } + + /** The LocationBasedRecommendedActionSessionsResultsClient object to access its operations. */ + private final LocationBasedRecommendedActionSessionsResultsClient locationBasedRecommendedActionSessionsResults; + + /** + * Gets the LocationBasedRecommendedActionSessionsResultsClient object to access its operations. + * + * @return the LocationBasedRecommendedActionSessionsResultsClient object. + */ + public LocationBasedRecommendedActionSessionsResultsClient getLocationBasedRecommendedActionSessionsResults() { + return this.locationBasedRecommendedActionSessionsResults; + } + + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** The PrivateLinkResourcesClient object to access its operations. */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** The ServerKeysClient object to access its operations. */ + private final ServerKeysClient serverKeys; + + /** + * Gets the ServerKeysClient object to access its operations. + * + * @return the ServerKeysClient object. + */ + public ServerKeysClient getServerKeys() { + return this.serverKeys; + } + /** * Initializes an instance of MySqlManagementClient client. * @@ -272,18 +457,34 @@ public OperationsClient getOperations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-05-01"; this.servers = new ServersClientImpl(this); this.replicas = new ReplicasClientImpl(this); - this.backups = new BackupsClientImpl(this); this.firewallRules = new FirewallRulesClientImpl(this); + this.virtualNetworkRules = new VirtualNetworkRulesClientImpl(this); this.databases = new DatabasesClientImpl(this); this.configurations = new ConfigurationsClientImpl(this); - this.locationBasedCapabilities = new LocationBasedCapabilitiesClientImpl(this); - this.checkVirtualNetworkSubnetUsages = new CheckVirtualNetworkSubnetUsagesClientImpl(this); + this.serverParameters = new ServerParametersClientImpl(this); + this.logFiles = new LogFilesClientImpl(this); + this.serverAdministrators = new ServerAdministratorsClientImpl(this); + this.recoverableServers = new RecoverableServersClientImpl(this); + this.serverBasedPerformanceTiers = new ServerBasedPerformanceTiersClientImpl(this); + this.locationBasedPerformanceTiers = new LocationBasedPerformanceTiersClientImpl(this); this.checkNameAvailabilities = new CheckNameAvailabilitiesClientImpl(this); - this.getPrivateDnsZoneSuffixes = new GetPrivateDnsZoneSuffixesClientImpl(this); this.operations = new OperationsClientImpl(this); + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesClientImpl(this); + this.queryTexts = new QueryTextsClientImpl(this); + this.topQueryStatistics = new TopQueryStatisticsClientImpl(this); + this.waitStatistics = new WaitStatisticsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.advisors = new AdvisorsClientImpl(this); + this.recommendedActions = new RecommendedActionsClientImpl(this); + this.locationBasedRecommendedActionSessionsOperationStatus = + new LocationBasedRecommendedActionSessionsOperationStatusClientImpl(this); + this.locationBasedRecommendedActionSessionsResults = + new LocationBasedRecommendedActionSessionsResultsClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.serverKeys = new ServerKeysClientImpl(this); } /** @@ -302,10 +503,7 @@ public Context getContext() { * @return the merged context. */ public Context mergeContext(Context context) { - for (Map.Entry entry : this.getContext().getValues().entrySet()) { - context = context.addData(entry.getKey(), entry.getValue()); - } - return context; + return CoreUtils.mergeContexts(this.getContext(), context); } /** diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationImpl.java deleted file mode 100644 index 853509cd0b7b5..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationImpl.java +++ /dev/null @@ -1,52 +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.mysqlflexibleserver.implementation; - -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.Operation; -import com.azure.resourcemanager.mysqlflexibleserver.models.OperationDisplay; -import java.util.Collections; -import java.util.Map; - -public final class OperationImpl implements Operation { - private OperationInner innerObject; - - private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - - OperationImpl( - OperationInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String name() { - return this.innerModel().name(); - } - - public OperationDisplay display() { - return this.innerModel().display(); - } - - public String origin() { - return this.innerModel().origin(); - } - - public Map properties() { - Map inner = this.innerModel().properties(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public OperationInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationListResultImpl.java similarity index 57% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationListResultImpl.java index 2a24bf58d993d..d30a74c51044a 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationListResultImpl.java @@ -4,26 +4,26 @@ package com.azure.resourcemanager.mysqlflexibleserver.implementation; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.DelegatedSubnetUsage; -import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkSubnetUsageResult; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.Operation; +import com.azure.resourcemanager.mysqlflexibleserver.models.OperationListResult; import java.util.Collections; import java.util.List; -public final class VirtualNetworkSubnetUsageResultImpl implements VirtualNetworkSubnetUsageResult { - private VirtualNetworkSubnetUsageResultInner innerObject; +public final class OperationListResultImpl implements OperationListResult { + private OperationListResultInner innerObject; private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - VirtualNetworkSubnetUsageResultImpl( - VirtualNetworkSubnetUsageResultInner innerObject, + OperationListResultImpl( + OperationListResultInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } - public List delegatedSubnetsUsage() { - List inner = this.innerModel().delegatedSubnetsUsage(); + public List value() { + List inner = this.innerModel().value(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -31,7 +31,7 @@ public List delegatedSubnetsUsage() { } } - public VirtualNetworkSubnetUsageResultInner innerModel() { + public OperationListResultInner innerModel() { return this.innerObject; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationsClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationsClientImpl.java index 3ac696b51cfa0..f332833434f84 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationsClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationsClientImpl.java @@ -10,24 +10,18 @@ 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.mysqlflexibleserver.fluent.OperationsClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.OperationListResult; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationListResultInner; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in OperationsClient. */ @@ -60,21 +54,11 @@ private interface OperationsService { @Get("/providers/Microsoft.DBforMySQL/operations") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( + Mono> list( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); } /** @@ -82,30 +66,21 @@ Mono> listNext( * * @throws 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 resource provider operations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a list of resource provider operations along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> listWithResponseAsync() { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -116,57 +91,21 @@ private Mono> listSinglePageAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 resource provider operations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a list of resource provider operations along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> listWithResponseAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } - - /** - * Lists all of the available REST API operations. - * - * @throws 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 resource provider operations as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Lists all of the available REST API operations. - * - * @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 resource provider operations as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + return service.list(this.client.getEndpoint(), apiVersion, accept, context); } /** @@ -174,97 +113,36 @@ private PagedFlux listAsync(Context context) { * * @throws 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 resource provider operations as paginated response with {@link PagedIterable}. + * @return a list of resource provider operations on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Lists all of the available REST API operations. * - * @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 resource provider operations as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The 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 resource provider operations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a list of resource provider operations. */ @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())); + public OperationListResultInner list() { + return listAsync().block(); } /** - * Get the next page of items. + * Lists all of the available REST API operations. * - * @param nextLink 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 resource provider operations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a list of resource provider operations along with {@link Response}. */ @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)); + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationsImpl.java index 3d57c6ae64e49..1c2301865025b 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationsImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/OperationsImpl.java @@ -4,12 +4,13 @@ package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.OperationsClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.Operation; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.OperationListResult; import com.azure.resourcemanager.mysqlflexibleserver.models.Operations; public final class OperationsImpl implements Operations { @@ -25,14 +26,26 @@ public OperationsImpl( this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + public OperationListResult list() { + OperationListResultInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationListResultImpl(inner, this.manager()); + } else { + return null; + } } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } } private OperationsClient serviceClient() { diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PerformanceTierPropertiesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PerformanceTierPropertiesImpl.java new file mode 100644 index 0000000000000..daae01daa8643 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PerformanceTierPropertiesImpl.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.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PerformanceTierProperties; +import com.azure.resourcemanager.mysqlflexibleserver.models.PerformanceTierServiceLevelObjectives; +import java.util.Collections; +import java.util.List; + +public final class PerformanceTierPropertiesImpl implements PerformanceTierProperties { + private PerformanceTierPropertiesInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + PerformanceTierPropertiesImpl( + PerformanceTierPropertiesInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public Integer maxBackupRetentionDays() { + return this.innerModel().maxBackupRetentionDays(); + } + + public Integer minBackupRetentionDays() { + return this.innerModel().minBackupRetentionDays(); + } + + public Integer maxStorageMB() { + return this.innerModel().maxStorageMB(); + } + + public Integer minLargeStorageMB() { + return this.innerModel().minLargeStorageMB(); + } + + public Integer maxLargeStorageMB() { + return this.innerModel().maxLargeStorageMB(); + } + + public Integer minStorageMB() { + return this.innerModel().minStorageMB(); + } + + public List serviceLevelObjectives() { + List inner = this.innerModel().serviceLevelObjectives(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PerformanceTierPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateEndpointConnectionImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..d72908c42e172 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateEndpointConnectionImpl.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.mysqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointConnection; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointProperty; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; +import com.azure.resourcemanager.mysqlflexibleserver.models.TagsObject; +import java.util.Map; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String privateEndpointConnectionName; + + private TagsObject updateParameters; + + public PrivateEndpointConnectionImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + this.updateParameters = new TagsObject(); + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .updateTags( + resourceGroupName, serverName, privateEndpointConnectionName, updateParameters, Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .updateTags(resourceGroupName, serverName, privateEndpointConnectionName, updateParameters, context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + public PrivateEndpointConnectionImpl withTags(Map tags) { + this.updateParameters.withTags(tags); + return this; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..a054cfbdd82af --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1508 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.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.mysqlflexibleserver.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointConnectionListResult; +import com.azure.resourcemanager.mysqlflexibleserver.models.TagsObject; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientPrivateEndpointConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateTags( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") TagsObject parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @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 a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTagsWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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 apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTags( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTagsWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName 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 apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTags( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + accept, + context); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> beginUpdateTagsAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + Mono>> mono = + updateTagsWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> beginUpdateTagsAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateTagsWithResponseAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner updateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + return updateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner updateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + return updateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Gets all private endpoint connections on a 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 all private endpoint connections on a 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 (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 all private endpoint connections on a 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 all private endpoint connections on a 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 (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all private endpoint connections on a 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 all private endpoint connections on a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets all private endpoint connections on a 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 all private endpoint connections on a 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 all private endpoint connections on a 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 all private endpoint connections on a 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 all private endpoint connections on a 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 all private endpoint connections on a 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 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 private endpoint connections 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 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 private endpoint connections 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateEndpointConnectionsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..b9a9a33048857 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointConnection; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointConnections; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PrivateEndpointConnection get( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, serverName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(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 PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PrivateEndpointConnection getById(String 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + public void deleteById(String 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateLinkResourceImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..ec9a618bbc5c4 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateLinkResourceImpl.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.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateLinkResourcesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..50ca8cc8e9e61 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,518 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("groupName") String groupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @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 private link resources for MySQL 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 private link resources for MySQL 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 (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 private link resources for MySQL 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 private link resources for MySQL 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 (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the private link resources for MySQL 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 private link resources for MySQL server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets the private link resources for MySQL 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 private link resources for MySQL 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 private link resources for MySQL 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 private link resources for MySQL 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 private link resources for MySQL 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 private link resources for MySQL 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)); + } + + /** + * Gets a private link resource for MySQL server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for MySQL server along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String groupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private link resource for MySQL server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for MySQL server along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String groupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private link resource for MySQL server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for MySQL server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String groupName) { + return getWithResponseAsync(resourceGroupName, serverName, groupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private link resource for MySQL server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for MySQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName) { + return getAsync(resourceGroupName, serverName, groupName).block(); + } + + /** + * Gets a private link resource for MySQL server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for MySQL server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, groupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 private link resources 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 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 private link resources 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateLinkResourcesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..32ab623042398 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/PrivateLinkResourcesImpl.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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkResources; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 PrivateLinkResourceImpl(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 PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PrivateLinkResource get(String resourceGroupName, String serverName, String groupName) { + PrivateLinkResourceInner inner = this.serviceClient().get(resourceGroupName, serverName, groupName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryPerformanceInsightResetDataResultImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryPerformanceInsightResetDataResultImpl.java new file mode 100644 index 0000000000000..22f1e506da1f3 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryPerformanceInsightResetDataResultImpl.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryPerformanceInsightResetDataResultInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryPerformanceInsightResetDataResult; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryPerformanceInsightResetDataResultState; + +public final class QueryPerformanceInsightResetDataResultImpl implements QueryPerformanceInsightResetDataResult { + private QueryPerformanceInsightResetDataResultInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + QueryPerformanceInsightResetDataResultImpl( + QueryPerformanceInsightResetDataResultInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public QueryPerformanceInsightResetDataResultState status() { + return this.innerModel().status(); + } + + public String message() { + return this.innerModel().message(); + } + + public QueryPerformanceInsightResetDataResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryStatisticImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryStatisticImpl.java new file mode 100644 index 0000000000000..2b08c3ddbef25 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryStatisticImpl.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.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryStatisticInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryStatistic; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class QueryStatisticImpl implements QueryStatistic { + private QueryStatisticInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + QueryStatisticImpl( + QueryStatisticInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 String queryId() { + return this.innerModel().queryId(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String aggregationFunction() { + return this.innerModel().aggregationFunction(); + } + + public List databaseNames() { + List inner = this.innerModel().databaseNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Long queryExecutionCount() { + return this.innerModel().queryExecutionCount(); + } + + public String metricName() { + return this.innerModel().metricName(); + } + + public String metricDisplayName() { + return this.innerModel().metricDisplayName(); + } + + public Double metricValue() { + return this.innerModel().metricValue(); + } + + public String metricValueUnit() { + return this.innerModel().metricValueUnit(); + } + + public QueryStatisticInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryTextImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryTextImpl.java new file mode 100644 index 0000000000000..84678c331575c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryTextImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryTextInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryText; + +public final class QueryTextImpl implements QueryText { + private QueryTextInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + QueryTextImpl( + QueryTextInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 String queryId() { + return this.innerModel().queryId(); + } + + public String queryText() { + return this.innerModel().queryText(); + } + + public QueryTextInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryTextsClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryTextsClientImpl.java new file mode 100644 index 0000000000000..470a1f7a40c4d --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryTextsClientImpl.java @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.QueryTextsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryTextInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryTextsResultList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in QueryTextsClient. */ +public final class QueryTextsClientImpl implements QueryTextsClient { + /** The proxy service used to perform REST calls. */ + private final QueryTextsService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of QueryTextsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueryTextsClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy.create(QueryTextsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientQueryTexts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface QueryTextsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/queryTexts/{queryId}") + @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("queryId") String queryId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/queryTexts") + @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, + @QueryParam(value = "queryIds", multipleQueryParams = true) List queryIds, + @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); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Text along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String queryId) { + 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 (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @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 Query Text along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String queryId, 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 (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryId, + accept, + context); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Text on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String queryId) { + return getWithResponseAsync(resourceGroupName, serverName, queryId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Text. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryTextInner get(String resourceGroupName, String serverName, String queryId) { + return getAsync(resourceGroupName, serverName, queryId).block(); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @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 Query Text along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String queryId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, queryId, context).block(); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 query texts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, List queryIds) { + 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 (queryIds == null) { + return Mono.error(new IllegalArgumentException("Parameter queryIds is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + List queryIdsConverted = + queryIds.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryIdsConverted, + 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())); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @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 query texts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, List queryIds, 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 (queryIds == null) { + return Mono.error(new IllegalArgumentException("Parameter queryIds is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + List queryIdsConverted = + queryIds.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryIdsConverted, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 query texts as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, List queryIds) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, queryIds), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @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 query texts as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, List queryIds, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, queryIds, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 query texts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, queryIds)); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @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 query texts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, queryIds, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 query texts 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 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 query texts 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryTextsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryTextsImpl.java new file mode 100644 index 0000000000000..5ec65d156c618 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/QueryTextsImpl.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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.QueryTextsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryTextInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryText; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryTexts; +import java.util.List; + +public final class QueryTextsImpl implements QueryTexts { + private static final ClientLogger LOGGER = new ClientLogger(QueryTextsImpl.class); + + private final QueryTextsClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public QueryTextsImpl( + QueryTextsClient innerClient, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public QueryText get(String resourceGroupName, String serverName, String queryId) { + QueryTextInner inner = this.serviceClient().get(resourceGroupName, serverName, queryId); + if (inner != null) { + return new QueryTextImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String queryId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, queryId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QueryTextImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, List queryIds) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, queryIds); + return Utils.mapPage(inner, inner1 -> new QueryTextImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, queryIds, context); + return Utils.mapPage(inner, inner1 -> new QueryTextImpl(inner1, this.manager())); + } + + private QueryTextsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendationActionImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendationActionImpl.java new file mode 100644 index 0000000000000..eb194fd2911e4 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendationActionImpl.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.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecommendationAction; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class RecommendationActionImpl implements RecommendationAction { + private RecommendationActionInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + RecommendationActionImpl( + RecommendationActionInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 String advisorName() { + return this.innerModel().advisorName(); + } + + public String sessionId() { + return this.innerModel().sessionId(); + } + + public Integer actionId() { + return this.innerModel().actionId(); + } + + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); + } + + public OffsetDateTime expirationTime() { + return this.innerModel().expirationTime(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public String recommendationType() { + return this.innerModel().recommendationType(); + } + + public Map details() { + Map inner = this.innerModel().details(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public RecommendationActionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendedActionSessionsOperationStatusImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendedActionSessionsOperationStatusImpl.java new file mode 100644 index 0000000000000..286c5da1fd6ec --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendedActionSessionsOperationStatusImpl.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.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendedActionSessionsOperationStatusInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecommendedActionSessionsOperationStatus; +import java.time.OffsetDateTime; + +public final class RecommendedActionSessionsOperationStatusImpl implements RecommendedActionSessionsOperationStatus { + private RecommendedActionSessionsOperationStatusInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + RecommendedActionSessionsOperationStatusImpl( + RecommendedActionSessionsOperationStatusInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String status() { + return this.innerModel().status(); + } + + public RecommendedActionSessionsOperationStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendedActionsClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendedActionsClientImpl.java new file mode 100644 index 0000000000000..c9afb2227e4ae --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendedActionsClientImpl.java @@ -0,0 +1,587 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.RecommendedActionsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecommendationActionsResultList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecommendedActionsClient. */ +public final class RecommendedActionsClientImpl implements RecommendedActionsClient { + /** The proxy service used to perform REST calls. */ + private final RecommendedActionsService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedActionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecommendedActionsClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy.create(RecommendedActionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientRecommendedActions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface RecommendedActionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}") + @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("advisorName") String advisorName, + @PathParam("recommendedActionName") String recommendedActionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/advisors/{advisorName}/recommendedActions") + @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, + @PathParam("advisorName") String advisorName, + @QueryParam("sessionId") String sessionId, + @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); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Recommendation Action along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName) { + 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + recommendedActionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action name. + * @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 Recommendation Action along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String advisorName, + String recommendedActionName, + 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + recommendedActionName, + accept, + context); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Recommendation Action on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName, recommendedActionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Recommendation Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendationActionInner get( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName) { + return getAsync(resourceGroupName, serverName, advisorName, recommendedActionName).block(); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action name. + * @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 Recommendation Action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String advisorName, + String recommendedActionName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName, recommendedActionName, context).block(); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recommendation actions along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, String advisorName, String sessionId) { + 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + sessionId, + 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())); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @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 recommendation actions along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, String advisorName, String sessionId, 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + sessionId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recommendation actions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, String advisorName, String sessionId) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, advisorName, sessionId), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recommendation actions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, String advisorName) { + final String sessionId = null; + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, advisorName, sessionId), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @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 recommendation actions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, advisorName, sessionId, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 recommendation actions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName) { + final String sessionId = null; + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, advisorName, sessionId)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @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 recommendation actions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, advisorName, sessionId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 recommendation actions 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 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 recommendation actions 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendedActionsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendedActionsImpl.java new file mode 100644 index 0000000000000..521095c78c024 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecommendedActionsImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.RecommendedActionsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecommendationAction; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecommendedActions; + +public final class RecommendedActionsImpl implements RecommendedActions { + private static final ClientLogger LOGGER = new ClientLogger(RecommendedActionsImpl.class); + + private final RecommendedActionsClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public RecommendedActionsImpl( + RecommendedActionsClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RecommendationAction get( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName) { + RecommendationActionInner inner = + this.serviceClient().get(resourceGroupName, serverName, advisorName, recommendedActionName); + if (inner != null) { + return new RecommendationActionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String advisorName, + String recommendedActionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, advisorName, recommendedActionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecommendationActionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, advisorName); + return Utils.mapPage(inner, inner1 -> new RecommendationActionImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, advisorName, sessionId, context); + return Utils.mapPage(inner, inner1 -> new RecommendationActionImpl(inner1, this.manager())); + } + + private RecommendedActionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecoverableServerResourceImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecoverableServerResourceImpl.java new file mode 100644 index 0000000000000..f312f54208263 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecoverableServerResourceImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecoverableServerResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecoverableServerResource; + +public final class RecoverableServerResourceImpl implements RecoverableServerResource { + private RecoverableServerResourceInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + RecoverableServerResourceImpl( + RecoverableServerResourceInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 String lastAvailableBackupDateTime() { + return this.innerModel().lastAvailableBackupDateTime(); + } + + public String serviceLevelObjective() { + return this.innerModel().serviceLevelObjective(); + } + + public String edition() { + return this.innerModel().edition(); + } + + public Integer vCore() { + return this.innerModel().vCore(); + } + + public String hardwareGeneration() { + return this.innerModel().hardwareGeneration(); + } + + public String version() { + return this.innerModel().version(); + } + + public RecoverableServerResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecoverableServersClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecoverableServersClientImpl.java new file mode 100644 index 0000000000000..157cfdd1e198c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecoverableServersClientImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.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.mysqlflexibleserver.fluent.RecoverableServersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecoverableServerResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecoverableServersClient. */ +public final class RecoverableServersClientImpl implements RecoverableServersClient { + /** The proxy service used to perform REST calls. */ + private final RecoverableServersService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoverableServersClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy.create(RecoverableServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientRecoverableServers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface RecoverableServersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/recoverableServers") + @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, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a recoverable MySQL 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 recoverable MySQL Server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a recoverable MySQL 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 recoverable MySQL Server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Gets a recoverable MySQL 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 recoverable MySQL Server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a recoverable MySQL 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 recoverable MySQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoverableServerResourceInner get(String resourceGroupName, String serverName) { + return getAsync(resourceGroupName, serverName).block(); + } + + /** + * Gets a recoverable MySQL 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 recoverable MySQL Server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecoverableServersImpl.java similarity index 51% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecoverableServersImpl.java index e3a8b442a8231..527fa8d9ec4c9 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/RecoverableServersImpl.java @@ -8,48 +8,50 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.GetPrivateDnsZoneSuffixResponseInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.GetPrivateDnsZoneSuffixResponse; -import com.azure.resourcemanager.mysqlflexibleserver.models.GetPrivateDnsZoneSuffixes; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.RecoverableServersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecoverableServerResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecoverableServerResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.RecoverableServers; -public final class GetPrivateDnsZoneSuffixesImpl implements GetPrivateDnsZoneSuffixes { - private static final ClientLogger LOGGER = new ClientLogger(GetPrivateDnsZoneSuffixesImpl.class); +public final class RecoverableServersImpl implements RecoverableServers { + private static final ClientLogger LOGGER = new ClientLogger(RecoverableServersImpl.class); - private final GetPrivateDnsZoneSuffixesClient innerClient; + private final RecoverableServersClient innerClient; private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; - public GetPrivateDnsZoneSuffixesImpl( - GetPrivateDnsZoneSuffixesClient innerClient, + public RecoverableServersImpl( + RecoverableServersClient innerClient, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } - public GetPrivateDnsZoneSuffixResponse execute() { - GetPrivateDnsZoneSuffixResponseInner inner = this.serviceClient().execute(); + public RecoverableServerResource get(String resourceGroupName, String serverName) { + RecoverableServerResourceInner inner = this.serviceClient().get(resourceGroupName, serverName); if (inner != null) { - return new GetPrivateDnsZoneSuffixResponseImpl(inner, this.manager()); + return new RecoverableServerResourceImpl(inner, this.manager()); } else { return null; } } - public Response executeWithResponse(Context context) { - Response inner = this.serviceClient().executeWithResponse(context); + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new GetPrivateDnsZoneSuffixResponseImpl(inner.getValue(), this.manager())); + new RecoverableServerResourceImpl(inner.getValue(), this.manager())); } else { return null; } } - private GetPrivateDnsZoneSuffixesClient serviceClient() { + private RecoverableServersClient serviceClient() { return this.innerClient; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ReplicasClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ReplicasClientImpl.java index 3d35a792a73a5..9bba793c31574 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ReplicasClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ReplicasClientImpl.java @@ -57,8 +57,8 @@ public final class ReplicasClientImpl implements ReplicasClient { private interface ReplicasService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/replicas") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/replicas") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer( @@ -69,16 +69,6 @@ Mono> listByServer( @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); } /** @@ -112,6 +102,7 @@ private Mono> listByServerSinglePageAsync(String reso if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -119,7 +110,7 @@ private Mono> listByServerSinglePageAsync(String reso service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -128,12 +119,7 @@ private Mono> listByServerSinglePageAsync(String reso .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -170,12 +156,13 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -184,12 +171,7 @@ private Mono> listByServerSinglePageAsync( .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -204,9 +186,7 @@ private Mono> listByServerSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName), - nextLink -> listByServerNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** @@ -222,9 +202,7 @@ private PagedFlux listByServerAsync(String resourceGroupName, Strin */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), - nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** @@ -257,75 +235,4 @@ public PagedIterable listByServer(String resourceGroupName, String 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 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 servers 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 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 servers 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ResourceProvidersClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..82a5c395ac71f --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,516 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +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.mysqlflexibleserver.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryPerformanceInsightResetDataResultInner; +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 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 MySqlManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientResourceProviders to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/resetQueryPerformanceInsightData") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> resetQueryPerformanceInsightData( + @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({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/advisors/{advisorName}/createRecommendedActionSession") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createRecommendedActionSession( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advisorName") String advisorName, + @QueryParam("databaseName") String databaseName, + Context context); + } + + /** + * Reset data for Query Performance Insight. + * + * @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 result of Query Performance Insight data reset along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + resetQueryPerformanceInsightDataWithResponseAsync(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 apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .resetQueryPerformanceInsightData( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Reset data for Query Performance Insight. + * + * @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 result of Query Performance Insight data reset along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + resetQueryPerformanceInsightDataWithResponseAsync( + 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 apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .resetQueryPerformanceInsightData( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Reset data for Query Performance Insight. + * + * @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 result of Query Performance Insight data reset on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resetQueryPerformanceInsightDataAsync( + String resourceGroupName, String serverName) { + return resetQueryPerformanceInsightDataWithResponseAsync(resourceGroupName, serverName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Reset data for Query Performance Insight. + * + * @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 result of Query Performance Insight data reset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryPerformanceInsightResetDataResultInner resetQueryPerformanceInsightData( + String resourceGroupName, String serverName) { + return resetQueryPerformanceInsightDataAsync(resourceGroupName, serverName).block(); + } + + /** + * Reset data for Query Performance Insight. + * + * @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 result of Query Performance Insight data reset along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response resetQueryPerformanceInsightDataWithResponse( + String resourceGroupName, String serverName, Context context) { + return resetQueryPerformanceInsightDataWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> createRecommendedActionSessionWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + return FluxUtil + .withContext( + context -> + service + .createRecommendedActionSession( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + databaseName, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @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>> createRecommendedActionSessionWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName, 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + context = this.client.mergeContext(context); + return service + .createRecommendedActionSession( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + databaseName, + context); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCreateRecommendedActionSessionAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + Mono>> mono = + createRecommendedActionSessionWithResponseAsync(resourceGroupName, serverName, advisorName, databaseName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCreateRecommendedActionSessionAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createRecommendedActionSessionWithResponseAsync( + resourceGroupName, serverName, advisorName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCreateRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + return beginCreateRecommendedActionSessionAsync(resourceGroupName, serverName, advisorName, databaseName) + .getSyncPoller(); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCreateRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + return beginCreateRecommendedActionSessionAsync( + resourceGroupName, serverName, advisorName, databaseName, context) + .getSyncPoller(); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createRecommendedActionSessionAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + return beginCreateRecommendedActionSessionAsync(resourceGroupName, serverName, advisorName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createRecommendedActionSessionAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + return beginCreateRecommendedActionSessionAsync( + resourceGroupName, serverName, advisorName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + createRecommendedActionSessionAsync(resourceGroupName, serverName, advisorName, databaseName).block(); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + createRecommendedActionSessionAsync(resourceGroupName, serverName, advisorName, databaseName, context).block(); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ResourceProvidersImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..ce27e69c81139 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryPerformanceInsightResetDataResultInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryPerformanceInsightResetDataResult; +import com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.MySqlManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public QueryPerformanceInsightResetDataResult resetQueryPerformanceInsightData( + String resourceGroupName, String serverName) { + QueryPerformanceInsightResetDataResultInner inner = + this.serviceClient().resetQueryPerformanceInsightData(resourceGroupName, serverName); + if (inner != null) { + return new QueryPerformanceInsightResetDataResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response resetQueryPerformanceInsightDataWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().resetQueryPerformanceInsightDataWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QueryPerformanceInsightResetDataResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + this.serviceClient().createRecommendedActionSession(resourceGroupName, serverName, advisorName, databaseName); + } + + public void createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + this + .serviceClient() + .createRecommendedActionSession(resourceGroupName, serverName, advisorName, databaseName, context); + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerAdministratorResourceImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerAdministratorResourceImpl.java new file mode 100644 index 0000000000000..6a53d336f217c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerAdministratorResourceImpl.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.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.AdministratorType; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerAdministratorResource; +import java.util.UUID; + +public final class ServerAdministratorResourceImpl implements ServerAdministratorResource { + private ServerAdministratorResourceInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + ServerAdministratorResourceImpl( + ServerAdministratorResourceInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 AdministratorType administratorType() { + return this.innerModel().administratorType(); + } + + public String login() { + return this.innerModel().login(); + } + + public UUID sid() { + return this.innerModel().sid(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public ServerAdministratorResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerAdministratorsClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerAdministratorsClientImpl.java new file mode 100644 index 0000000000000..17cfe958f9d5c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerAdministratorsClientImpl.java @@ -0,0 +1,965 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServerAdministratorsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerAdministratorResourceListResult; +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 ServerAdministratorsClient. */ +public final class ServerAdministratorsClientImpl implements ServerAdministratorsClient { + /** The proxy service used to perform REST calls. */ + private final ServerAdministratorsService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAdministratorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAdministratorsClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerAdministratorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientServerAdministrators to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface ServerAdministratorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/administrators/activeDirectory") + @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, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/administrators/activeDirectory") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") ServerAdministratorResourceInner properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/administrators/activeDirectory") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/administrators") + @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); + } + + /** + * Gets information about a AAD server administrator. + * + * @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 information about a AAD server administrator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a AAD server administrator. + * + * @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 information about a AAD server administrator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Gets information about a AAD server administrator. + * + * @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 information about a AAD server administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about a AAD server administrator. + * + * @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 information about a AAD server administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAdministratorResourceInner get(String resourceGroupName, String serverName) { + return getAsync(resourceGroupName, serverName).block(); + } + + /** + * Gets information about a AAD server administrator. + * + * @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 information about a AAD server administrator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 and external administrator to be created along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @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 and external administrator to be created along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + properties, + accept, + context); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerAdministratorResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, properties); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAdministratorResourceInner.class, + ServerAdministratorResourceInner.class, + this.client.getContext()); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerAdministratorResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, properties, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAdministratorResourceInner.class, + ServerAdministratorResourceInner.class, + context); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerAdministratorResourceInner> + beginCreateOrUpdate(String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, properties).getSyncPoller(); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerAdministratorResourceInner> + beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, properties, context).getSyncPoller(); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 and external administrator to be created on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, properties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @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 and external administrator to be created on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, properties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAdministratorResourceInner createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + return createOrUpdateAsync(resourceGroupName, serverName, properties).block(); + } + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @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 and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAdministratorResourceInner createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, properties, context).block(); + } + + /** + * Deletes server active directory administrator. + * + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes server active directory administrator. + * + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Deletes server active directory administrator. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes server active directory administrator. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes server active directory administrator. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName) { + return beginDeleteAsync(resourceGroupName, serverName).getSyncPoller(); + } + + /** + * Deletes server active directory administrator. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, context).getSyncPoller(); + } + + /** + * Deletes server active directory administrator. + * + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName) { + return beginDeleteAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes server active directory administrator. + * + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes server active directory administrator. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName) { + deleteAsync(resourceGroupName, serverName).block(); + } + + /** + * Deletes server active directory administrator. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, Context context) { + deleteAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request 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)); + } + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serverName) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName)); + } + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request 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)); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerAdministratorsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerAdministratorsImpl.java new file mode 100644 index 0000000000000..452a890cc28f4 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerAdministratorsImpl.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.ServerAdministratorsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerAdministratorResource; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerAdministrators; + +public final class ServerAdministratorsImpl implements ServerAdministrators { + private static final ClientLogger LOGGER = new ClientLogger(ServerAdministratorsImpl.class); + + private final ServerAdministratorsClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public ServerAdministratorsImpl( + ServerAdministratorsClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerAdministratorResource get(String resourceGroupName, String serverName) { + ServerAdministratorResourceInner inner = this.serviceClient().get(resourceGroupName, serverName); + if (inner != null) { + return new ServerAdministratorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAdministratorResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerAdministratorResource createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + ServerAdministratorResourceInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, serverName, properties); + if (inner != null) { + return new ServerAdministratorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerAdministratorResource createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + ServerAdministratorResourceInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, serverName, properties, context); + if (inner != null) { + return new ServerAdministratorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String serverName) { + this.serviceClient().delete(resourceGroupName, serverName); + } + + public void delete(String resourceGroupName, String serverName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, context); + } + + public PagedIterable list(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerAdministratorResourceImpl(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 ServerAdministratorResourceImpl(inner1, this.manager())); + } + + private ServerAdministratorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerBasedPerformanceTiersClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerBasedPerformanceTiersClientImpl.java new file mode 100644 index 0000000000000..06db25ef83815 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerBasedPerformanceTiersClientImpl.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PerformanceTierListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerBasedPerformanceTiersClient. */ +public final class ServerBasedPerformanceTiersClientImpl implements ServerBasedPerformanceTiersClient { + /** The proxy service used to perform REST calls. */ + private final ServerBasedPerformanceTiersService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of ServerBasedPerformanceTiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerBasedPerformanceTiersClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerBasedPerformanceTiersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientServerBasedPerformanceTiers to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface ServerBasedPerformanceTiersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/performanceTiers") + @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); + } + + /** + * List all the performance tiers for a MySQL 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 performance tiers 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the performance tiers for a MySQL 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 performance tiers 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the performance tiers for a MySQL 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 performance tiers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the performance tiers for a MySQL 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 performance tiers 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)); + } + + /** + * List all the performance tiers for a MySQL 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 performance tiers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serverName) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName)); + } + + /** + * List all the performance tiers for a MySQL 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 performance tiers 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)); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerBasedPerformanceTiersImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerBasedPerformanceTiersImpl.java new file mode 100644 index 0000000000000..b9b5b12a764ef --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerBasedPerformanceTiersImpl.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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.PerformanceTierProperties; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerBasedPerformanceTiers; + +public final class ServerBasedPerformanceTiersImpl implements ServerBasedPerformanceTiers { + private static final ClientLogger LOGGER = new ClientLogger(ServerBasedPerformanceTiersImpl.class); + + private final ServerBasedPerformanceTiersClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public ServerBasedPerformanceTiersImpl( + ServerBasedPerformanceTiersClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 PerformanceTierPropertiesImpl(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 PerformanceTierPropertiesImpl(inner1, this.manager())); + } + + private ServerBasedPerformanceTiersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerImpl.java index da9011db91e54..814177c3db7db 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerImpl.java @@ -5,26 +5,26 @@ package com.azure.resourcemanager.mysqlflexibleserver.implementation; import com.azure.core.management.Region; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.Backup; -import com.azure.resourcemanager.mysqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryption; -import com.azure.resourcemanager.mysqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.mysqlflexibleserver.models.Identity; -import com.azure.resourcemanager.mysqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.mysqlflexibleserver.models.Network; -import com.azure.resourcemanager.mysqlflexibleserver.models.ReplicationRole; +import com.azure.resourcemanager.mysqlflexibleserver.models.InfrastructureEncryption; +import com.azure.resourcemanager.mysqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.ResourceIdentity; import com.azure.resourcemanager.mysqlflexibleserver.models.Server; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerForUpdate; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerRestartParameter; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerForCreate; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPropertiesForCreate; import com.azure.resourcemanager.mysqlflexibleserver.models.ServerState; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerUpdateParameters; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerUpgradeParameters; import com.azure.resourcemanager.mysqlflexibleserver.models.ServerVersion; import com.azure.resourcemanager.mysqlflexibleserver.models.Sku; -import com.azure.resourcemanager.mysqlflexibleserver.models.Storage; +import com.azure.resourcemanager.mysqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.StorageProfile; import java.time.OffsetDateTime; import java.util.Collections; +import java.util.List; import java.util.Map; public final class ServerImpl implements Server, Server.Definition, Server.Update { @@ -57,7 +57,7 @@ public Map tags() { } } - public Identity identity() { + public ResourceIdentity identity() { return this.innerModel().identity(); } @@ -65,76 +65,69 @@ public Sku sku() { return this.innerModel().sku(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String administratorLogin() { return this.innerModel().administratorLogin(); } - public String administratorLoginPassword() { - return this.innerModel().administratorLoginPassword(); - } - public ServerVersion version() { return this.innerModel().version(); } - public String availabilityZone() { - return this.innerModel().availabilityZone(); - } - - public CreateMode createMode() { - return this.innerModel().createMode(); + public SslEnforcementEnum sslEnforcement() { + return this.innerModel().sslEnforcement(); } - public String sourceServerResourceId() { - return this.innerModel().sourceServerResourceId(); + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.innerModel().minimalTlsVersion(); } - public OffsetDateTime restorePointInTime() { - return this.innerModel().restorePointInTime(); + public String byokEnforcement() { + return this.innerModel().byokEnforcement(); } - public ReplicationRole replicationRole() { - return this.innerModel().replicationRole(); + public InfrastructureEncryption infrastructureEncryption() { + return this.innerModel().infrastructureEncryption(); } - public Integer replicaCapacity() { - return this.innerModel().replicaCapacity(); + public ServerState userVisibleState() { + return this.innerModel().userVisibleState(); } - public DataEncryption dataEncryption() { - return this.innerModel().dataEncryption(); + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); } - public ServerState state() { - return this.innerModel().state(); + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); } - public String fullyQualifiedDomainName() { - return this.innerModel().fullyQualifiedDomainName(); + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); } - public Storage storage() { - return this.innerModel().storage(); + public String replicationRole() { + return this.innerModel().replicationRole(); } - public Backup backup() { - return this.innerModel().backup(); + public String masterServerId() { + return this.innerModel().masterServerId(); } - public HighAvailability highAvailability() { - return this.innerModel().highAvailability(); + public Integer replicaCapacity() { + return this.innerModel().replicaCapacity(); } - public Network network() { - return this.innerModel().network(); + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); } - public MaintenanceWindow maintenanceWindow() { - return this.innerModel().maintenanceWindow(); + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } } public Region region() { @@ -145,6 +138,10 @@ public String regionName() { return this.location(); } + public String resourceGroupName() { + return resourceGroupName; + } + public ServerInner innerModel() { return this.innerObject; } @@ -157,7 +154,9 @@ private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { private String serverName; - private ServerForUpdate updateParameters; + private ServerForCreate createParameters; + + private ServerUpdateParameters updateParameters; public ServerImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; @@ -169,7 +168,7 @@ public Server create() { serviceManager .serviceClient() .getServers() - .create(resourceGroupName, serverName, this.innerModel(), Context.NONE); + .create(resourceGroupName, serverName, createParameters, Context.NONE); return this; } @@ -178,7 +177,7 @@ public Server create(Context context) { serviceManager .serviceClient() .getServers() - .create(resourceGroupName, serverName, this.innerModel(), context); + .create(resourceGroupName, serverName, createParameters, context); return this; } @@ -186,10 +185,11 @@ public Server create(Context context) { this.innerObject = new ServerInner(); this.serviceManager = serviceManager; this.serverName = name; + this.createParameters = new ServerForCreate(); } public ServerImpl update() { - this.updateParameters = new ServerForUpdate(); + this.updateParameters = new ServerUpdateParameters(); return this; } @@ -215,7 +215,7 @@ public Server apply(Context context) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.serverName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); } public Server refresh() { @@ -238,20 +238,12 @@ public Server refresh(Context context) { return this; } - public void failover() { - serviceManager.servers().failover(resourceGroupName, serverName); - } - - public void failover(Context context) { - serviceManager.servers().failover(resourceGroupName, serverName, context); - } - - public void restart(ServerRestartParameter parameters) { - serviceManager.servers().restart(resourceGroupName, serverName, parameters); + public void restart() { + serviceManager.servers().restart(resourceGroupName, serverName); } - public void restart(ServerRestartParameter parameters, Context context) { - serviceManager.servers().restart(resourceGroupName, serverName, parameters, context); + public void restart(Context context) { + serviceManager.servers().restart(resourceGroupName, serverName, context); } public void start() { @@ -270,19 +262,32 @@ public void stop(Context context) { serviceManager.servers().stop(resourceGroupName, serverName, context); } + public void upgrade(ServerUpgradeParameters parameters) { + serviceManager.servers().upgrade(resourceGroupName, serverName, parameters); + } + + public void upgrade(ServerUpgradeParameters parameters, Context context) { + serviceManager.servers().upgrade(resourceGroupName, serverName, parameters, context); + } + public ServerImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); + this.createParameters.withLocation(location.toString()); return this; } public ServerImpl withRegion(String location) { - this.innerModel().withLocation(location); + this.createParameters.withLocation(location); + return this; + } + + public ServerImpl withProperties(ServerPropertiesForCreate properties) { + this.createParameters.withProperties(properties); return this; } public ServerImpl withTags(Map tags) { if (isInCreateMode()) { - this.innerModel().withTags(tags); + this.createParameters.withTags(tags); return this; } else { this.updateParameters.withTags(tags); @@ -290,9 +295,9 @@ public ServerImpl withTags(Map tags) { } } - public ServerImpl withIdentity(Identity identity) { + public ServerImpl withIdentity(ResourceIdentity identity) { if (isInCreateMode()) { - this.innerModel().withIdentity(identity); + this.createParameters.withIdentity(identity); return this; } else { this.updateParameters.withIdentity(identity); @@ -302,7 +307,7 @@ public ServerImpl withIdentity(Identity identity) { public ServerImpl withSku(Sku sku) { if (isInCreateMode()) { - this.innerModel().withSku(sku); + this.createParameters.withSku(sku); return this; } else { this.updateParameters.withSku(sku); @@ -310,103 +315,38 @@ public ServerImpl withSku(Sku sku) { } } - public ServerImpl withAdministratorLogin(String administratorLogin) { - this.innerModel().withAdministratorLogin(administratorLogin); + public ServerImpl withStorageProfile(StorageProfile storageProfile) { + this.updateParameters.withStorageProfile(storageProfile); return this; } public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { - if (isInCreateMode()) { - this.innerModel().withAdministratorLoginPassword(administratorLoginPassword); - return this; - } else { - this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); - return this; - } - } - - public ServerImpl withVersion(ServerVersion version) { - this.innerModel().withVersion(version); + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); return this; } - public ServerImpl withAvailabilityZone(String availabilityZone) { - this.innerModel().withAvailabilityZone(availabilityZone); - return this; - } - - public ServerImpl withCreateMode(CreateMode createMode) { - this.innerModel().withCreateMode(createMode); + public ServerImpl withVersion(ServerVersion version) { + this.updateParameters.withVersion(version); return this; } - public ServerImpl withSourceServerResourceId(String sourceServerResourceId) { - this.innerModel().withSourceServerResourceId(sourceServerResourceId); + public ServerImpl withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.updateParameters.withSslEnforcement(sslEnforcement); return this; } - public ServerImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { - this.innerModel().withRestorePointInTime(restorePointInTime); + public ServerImpl withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.updateParameters.withMinimalTlsVersion(minimalTlsVersion); return this; } - public ServerImpl withReplicationRole(ReplicationRole replicationRole) { - if (isInCreateMode()) { - this.innerModel().withReplicationRole(replicationRole); - return this; - } else { - this.updateParameters.withReplicationRole(replicationRole); - return this; - } - } - - public ServerImpl withDataEncryption(DataEncryption dataEncryption) { - if (isInCreateMode()) { - this.innerModel().withDataEncryption(dataEncryption); - return this; - } else { - this.updateParameters.withDataEncryption(dataEncryption); - return this; - } - } - - public ServerImpl withStorage(Storage storage) { - if (isInCreateMode()) { - this.innerModel().withStorage(storage); - return this; - } else { - this.updateParameters.withStorage(storage); - return this; - } - } - - public ServerImpl withBackup(Backup backup) { - if (isInCreateMode()) { - this.innerModel().withBackup(backup); - return this; - } else { - this.updateParameters.withBackup(backup); - return this; - } - } - - public ServerImpl withHighAvailability(HighAvailability highAvailability) { - if (isInCreateMode()) { - this.innerModel().withHighAvailability(highAvailability); - return this; - } else { - this.updateParameters.withHighAvailability(highAvailability); - return this; - } - } - - public ServerImpl withNetwork(Network network) { - this.innerModel().withNetwork(network); + public ServerImpl withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.updateParameters.withPublicNetworkAccess(publicNetworkAccess); return this; } - public ServerImpl withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { - this.updateParameters.withMaintenanceWindow(maintenanceWindow); + public ServerImpl withReplicationRole(String replicationRole) { + this.updateParameters.withReplicationRole(replicationRole); return this; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerKeyImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerKeyImpl.java new file mode 100644 index 0000000000000..6732450e5bc7d --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerKeyImpl.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKey; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKeyType; +import java.time.OffsetDateTime; + +public final class ServerKeyImpl implements ServerKey, ServerKey.Definition, ServerKey.Update { + private ServerKeyInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerKeyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } + + private String serverName; + + private String keyName; + + private String resourceGroupName; + + public ServerKeyImpl withExistingServer(String serverName, String resourceGroupName) { + this.serverName = serverName; + this.resourceGroupName = resourceGroupName; + return this; + } + + public ServerKey create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(serverName, keyName, resourceGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ServerKey create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(serverName, keyName, resourceGroupName, this.innerModel(), context); + return this; + } + + ServerKeyImpl(String name, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = new ServerKeyInner(); + this.serviceManager = serviceManager; + this.keyName = name; + } + + public ServerKeyImpl update() { + return this; + } + + public ServerKey apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(serverName, keyName, resourceGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ServerKey apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(serverName, keyName, resourceGroupName, this.innerModel(), context); + return this; + } + + ServerKeyImpl( + ServerKeyInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.keyName = Utils.getValueFromIdByName(innerObject.id(), "keys"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + } + + public ServerKey refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .getWithResponse(resourceGroupName, serverName, keyName, Context.NONE) + .getValue(); + return this; + } + + public ServerKey refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .getWithResponse(resourceGroupName, serverName, keyName, context) + .getValue(); + return this; + } + + public ServerKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public ServerKeyImpl withUri(String uri) { + this.innerModel().withUri(uri); + return this; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerKeysClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerKeysClientImpl.java new file mode 100644 index 0000000000000..d2833ee19b489 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerKeysClientImpl.java @@ -0,0 +1,1086 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServerKeysClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKeyListResult; +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 ServerKeysClient. */ +public final class ServerKeysClientImpl implements ServerKeysClient { + /** The proxy service used to perform REST calls. */ + private final ServerKeysService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of ServerKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerKeysClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientServerKeys to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface ServerKeysService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/keys") + @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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/keys/{keyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/keys/{keyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @BodyParam("application/json") ServerKeyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/keys/{keyName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{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); + } + + /** + * Gets a list of Server keys. + * + * @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 Server keys 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 apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + 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 a list of Server keys. + * + * @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 Server keys 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 apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + 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 a list of Server keys. + * + * @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 Server keys as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serverName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Server keys. + * + * @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 Server keys 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)); + } + + /** + * Gets a list of Server keys. + * + * @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 Server keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serverName) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of Server keys. + * + * @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 Server keys 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)); + } + + /** + * Gets a MySQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 MySQL Server key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String keyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a MySQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be retrieved. + * @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 MySQL Server key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String keyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a MySQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 MySQL Server key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String keyName) { + return getWithResponseAsync(resourceGroupName, serverName, keyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a MySQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner get(String resourceGroupName, String serverName, String keyName) { + return getAsync(resourceGroupName, serverName, keyName).block(); + } + + /** + * Gets a MySQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be retrieved. + * @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 MySQL Server key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, keyName, context).block(); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 MySQL Server key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @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 MySQL Server key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + parameters, + accept, + context); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(serverName, keyName, resourceGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerKeyInner.class, + ServerKeyInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @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 a MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(serverName, keyName, resourceGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerKeyInner.class, ServerKeyInner.class, context); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + return beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @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 a MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + return beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 MySQL Server key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + return beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @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 MySQL Server key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + return beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner createOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + return createOrUpdateAsync(serverName, keyName, resourceGroupName, parameters).block(); + } + + /** + * Creates or updates a MySQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested MySQL Server key resource state. + * @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 MySQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner createOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + return createOrUpdateAsync(serverName, keyName, resourceGroupName, parameters, context).block(); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String serverName, String keyName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String serverName, String keyName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String serverName, String keyName, String resourceGroupName) { + Mono>> mono = deleteWithResponseAsync(serverName, keyName, resourceGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String serverName, String keyName, String resourceGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(serverName, keyName, resourceGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String serverName, String keyName, String resourceGroupName) { + return beginDeleteAsync(serverName, keyName, resourceGroupName).getSyncPoller(); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String serverName, String keyName, String resourceGroupName, Context context) { + return beginDeleteAsync(serverName, keyName, resourceGroupName, context).getSyncPoller(); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String serverName, String keyName, String resourceGroupName) { + return beginDeleteAsync(serverName, keyName, resourceGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String serverName, String keyName, String resourceGroupName, Context context) { + return beginDeleteAsync(serverName, keyName, resourceGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String serverName, String keyName, String resourceGroupName) { + deleteAsync(serverName, keyName, resourceGroupName).block(); + } + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String serverName, String keyName, String resourceGroupName, Context context) { + deleteAsync(serverName, keyName, resourceGroupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 MySQL Server keys 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 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 MySQL Server keys 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerKeysImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerKeysImpl.java new file mode 100644 index 0000000000000..16ff648b52d89 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerKeysImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.ServerKeysClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKey; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKeys; + +public final class ServerKeysImpl implements ServerKeys { + private static final ClientLogger LOGGER = new ClientLogger(ServerKeysImpl.class); + + private final ServerKeysClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public ServerKeysImpl( + ServerKeysClient innerClient, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 ServerKeyImpl(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 ServerKeyImpl(inner1, this.manager())); + } + + public ServerKey get(String resourceGroupName, String serverName, String keyName) { + ServerKeyInner inner = this.serviceClient().get(resourceGroupName, serverName, keyName); + if (inner != null) { + return new ServerKeyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, keyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerKeyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String serverName, String keyName, String resourceGroupName) { + this.serviceClient().delete(serverName, keyName, resourceGroupName); + } + + public void delete(String serverName, String keyName, String resourceGroupName, Context context) { + this.serviceClient().delete(serverName, keyName, resourceGroupName, context); + } + + public ServerKey getById(String 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, keyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, keyName, context); + } + + public void deleteById(String id) { + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", 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))); + } + this.delete(serverName, keyName, resourceGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", 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))); + } + this.delete(serverName, keyName, resourceGroupName, context); + } + + private ServerKeysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } + + public ServerKeyImpl define(String name) { + return new ServerKeyImpl(name, this.manager()); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerParametersClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerParametersClientImpl.java new file mode 100644 index 0000000000000..8721ec5e89fb3 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerParametersClientImpl.java @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.ServerParametersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; +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 ServerParametersClient. */ +public final class ServerParametersClientImpl implements ServerParametersClient { + /** The proxy service used to perform REST calls. */ + private final ServerParametersService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of ServerParametersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerParametersClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientServerParameters to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface ServerParametersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/updateConfigurations") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listUpdateConfigurations( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") ConfigurationListResultInner value, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server configurations along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listUpdateConfigurationsWithResponseAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + 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 (value == null) { + return Mono.error(new IllegalArgumentException("Parameter value is required and cannot be null.")); + } else { + value.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUpdateConfigurations( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + value, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 server configurations along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listUpdateConfigurationsWithResponseAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value, 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 (value == null) { + return Mono.error(new IllegalArgumentException("Parameter value is required and cannot be null.")); + } else { + value.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUpdateConfigurations( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + value, + accept, + context); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ConfigurationListResultInner> + beginListUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + Mono>> mono = + listUpdateConfigurationsWithResponseAsync(resourceGroupName, serverName, value); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfigurationListResultInner.class, + ConfigurationListResultInner.class, + this.client.getContext()); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ConfigurationListResultInner> + beginListUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + listUpdateConfigurationsWithResponseAsync(resourceGroupName, serverName, value, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfigurationListResultInner.class, + ConfigurationListResultInner.class, + context); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ConfigurationListResultInner> + beginListUpdateConfigurations(String resourceGroupName, String serverName, ConfigurationListResultInner value) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value).getSyncPoller(); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ConfigurationListResultInner> + beginListUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value, context).getSyncPoller(); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server configurations on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 server configurations on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + return listUpdateConfigurationsAsync(resourceGroupName, serverName, value).block(); + } + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + return listUpdateConfigurationsAsync(resourceGroupName, serverName, value, context).block(); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerParametersImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerParametersImpl.java new file mode 100644 index 0000000000000..9918a986e91d7 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerParametersImpl.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.mysqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServerParametersClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationListResult; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerParameters; + +public final class ServerParametersImpl implements ServerParameters { + private static final ClientLogger LOGGER = new ClientLogger(ServerParametersImpl.class); + + private final ServerParametersClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public ServerParametersImpl( + ServerParametersClient innerClient, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + ConfigurationListResultInner inner = + this.serviceClient().listUpdateConfigurations(resourceGroupName, serverName, value); + if (inner != null) { + return new ConfigurationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + ConfigurationListResultInner inner = + this.serviceClient().listUpdateConfigurations(resourceGroupName, serverName, value, context); + if (inner != null) { + return new ConfigurationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ServerParametersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerSecurityAlertPoliciesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerSecurityAlertPoliciesClientImpl.java new file mode 100644 index 0000000000000..ef1f35e4d6269 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,883 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicyListResult; +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 ServerSecurityAlertPoliciesClient. */ +public final class ServerSecurityAlertPoliciesClientImpl implements ServerSecurityAlertPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ServerSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of ServerSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerSecurityAlertPoliciesClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerSecurityAlertPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientServerSecurityAlertPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface ServerSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/securityAlertPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + return getAsync(resourceGroupName, serverName, securityAlertPolicyName).block(); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, context).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, securityAlertPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @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 server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context).block(); + } + + /** + * Get the server's threat detection policies. + * + * @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 server's threat detection policies 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 (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 server's threat detection policies. + * + * @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 server's threat detection policies 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 (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the server's threat detection policies. + * + * @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 server's threat detection policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Get the server's threat detection policies. + * + * @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 server's threat detection policies 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)); + } + + /** + * Get the server's threat detection policies. + * + * @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 server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Get the server's threat detection policies. + * + * @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 server's threat detection policies 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 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 the server's security alert policies 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 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 the server's security alert policies 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerSecurityAlertPoliciesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..88a88a4f47a8e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerSecurityAlertPoliciesImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicy; + +public final class ServerSecurityAlertPoliciesImpl implements ServerSecurityAlertPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ServerSecurityAlertPoliciesImpl.class); + + private final ServerSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public ServerSecurityAlertPoliciesImpl( + ServerSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + ServerSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, securityAlertPolicyName); + if (inner != null) { + return new ServerSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerSecurityAlertPolicyImpl(inner.getValue(), 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 ServerSecurityAlertPolicyImpl(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 ServerSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public ServerSecurityAlertPolicy getById(String 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + } + + private ServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } + + public ServerSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new ServerSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerSecurityAlertPolicyImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..e67c76d3beb12 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServerSecurityAlertPolicyImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicy; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicyState; +import java.util.Collections; +import java.util.List; + +public final class ServerSecurityAlertPolicyImpl + implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { + private ServerSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ServerSecurityAlertPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private SecurityAlertPolicyName securityAlertPolicyName; + + public ServerSecurityAlertPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl( + SecurityAlertPolicyName name, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = new ServerSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public ServerSecurityAlertPolicyImpl update() { + return this; + } + + public ServerSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl( + ServerSecurityAlertPolicyInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public ServerSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicyImpl withState(ServerSecurityAlertPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServersClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServersClientImpl.java index 53592518c0b53..a3df5c87e8132 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServersClientImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServersClientImpl.java @@ -35,9 +35,10 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServersClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerForUpdate; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerForCreate; import com.azure.resourcemanager.mysqlflexibleserver.models.ServerListResult; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerRestartParameter; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerUpdateParameters; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerUpgradeParameters; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -69,8 +70,8 @@ public final class ServersClientImpl implements ServersClient { private interface ServersService { @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}") @ExpectedResponses({200, 201, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -79,14 +80,14 @@ Mono>> create( @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, - @BodyParam("application/json") ServerInner parameters, + @BodyParam("application/json") ServerForCreate parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @@ -95,14 +96,14 @@ Mono>> update( @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, - @BodyParam("application/json") ServerForUpdate parameters, + @BodyParam("application/json") ServerUpdateParameters parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -116,8 +117,8 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @@ -131,8 +132,7 @@ Mono> getByResourceGroup( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @@ -144,7 +144,7 @@ Mono> listByResourceGroup( Context context); @Headers({"Content-Type: application/json"}) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/flexibleServers") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/servers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -156,11 +156,11 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/failover") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/restart") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> failover( + Mono>> restart( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -171,27 +171,26 @@ Mono>> failover( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/restart") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/start") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> restart( + Mono>> start( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, - @BodyParam("application/json") ServerRestartParameter parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/start") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/stop") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> start( + Mono>> stop( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -202,36 +201,17 @@ Mono>> start( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL" - + "/flexibleServers/{serverName}/stop") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/upgrade") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> stop( + Mono>> upgrade( @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> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, + @BodyParam("application/json") ServerUpgradeParameters parameters, @HeaderParam("Accept") String accept, Context context); } @@ -249,7 +229,7 @@ Mono> listNext( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createWithResponseAsync( - String resourceGroupName, String serverName, ServerInner parameters) { + String resourceGroupName, String serverName, ServerForCreate parameters) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -274,6 +254,7 @@ private Mono>> createWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -281,7 +262,7 @@ private Mono>> createWithResponseAsync( service .create( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -305,7 +286,7 @@ private Mono>> createWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createWithResponseAsync( - String resourceGroupName, String serverName, ServerInner parameters, Context context) { + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -330,12 +311,13 @@ private Mono>> createWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .create( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -357,7 +339,7 @@ private Mono>> createWithResponseAsync( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ServerInner> beginCreateAsync( - String resourceGroupName, String serverName, ServerInner parameters) { + String resourceGroupName, String serverName, ServerForCreate parameters) { Mono>> mono = createWithResponseAsync(resourceGroupName, serverName, parameters); return this .client @@ -379,7 +361,7 @@ private PollerFlux, ServerInner> beginCreateAsync( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ServerInner> beginCreateAsync( - String resourceGroupName, String serverName, ServerInner parameters, Context context) { + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { context = this.client.mergeContext(context); Mono>> mono = createWithResponseAsync(resourceGroupName, serverName, parameters, context); @@ -402,7 +384,7 @@ private PollerFlux, ServerInner> beginCreateAsync( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerInner> beginCreate( - String resourceGroupName, String serverName, ServerInner parameters) { + String resourceGroupName, String serverName, ServerForCreate parameters) { return beginCreateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); } @@ -420,7 +402,7 @@ public SyncPoller, ServerInner> beginCreate( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerInner> beginCreate( - String resourceGroupName, String serverName, ServerInner parameters, Context context) { + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { return beginCreateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); } @@ -436,7 +418,7 @@ public SyncPoller, ServerInner> beginCreate( * @return represents a server on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String serverName, ServerInner parameters) { + private Mono createAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { return beginCreateAsync(resourceGroupName, serverName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); @@ -456,7 +438,7 @@ private Mono createAsync(String resourceGroupName, String serverNam */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createAsync( - String resourceGroupName, String serverName, ServerInner parameters, Context context) { + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { return beginCreateAsync(resourceGroupName, serverName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); @@ -474,7 +456,7 @@ private Mono createAsync( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerInner create(String resourceGroupName, String serverName, ServerInner parameters) { + public ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters) { return createAsync(resourceGroupName, serverName, parameters).block(); } @@ -491,7 +473,8 @@ public ServerInner create(String resourceGroupName, String serverName, ServerInn * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerInner create(String resourceGroupName, String serverName, ServerInner parameters, Context context) { + public ServerInner create( + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { return createAsync(resourceGroupName, serverName, parameters, context).block(); } @@ -509,7 +492,7 @@ public ServerInner create(String resourceGroupName, String serverName, ServerInn */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -534,6 +517,7 @@ private Mono>> updateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -541,7 +525,7 @@ private Mono>> updateWithResponseAsync( service .update( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -566,7 +550,7 @@ private Mono>> updateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -591,12 +575,13 @@ private Mono>> updateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .update( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -619,7 +604,7 @@ private Mono>> updateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ServerInner> beginUpdateAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { Mono>> mono = updateWithResponseAsync(resourceGroupName, serverName, parameters); return this .client @@ -642,7 +627,7 @@ private PollerFlux, ServerInner> beginUpdateAsync( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ServerInner> beginUpdateAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { context = this.client.mergeContext(context); Mono>> mono = updateWithResponseAsync(resourceGroupName, serverName, parameters, context); @@ -666,7 +651,7 @@ private PollerFlux, ServerInner> beginUpdateAsync( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerInner> beginUpdate( - String resourceGroupName, String serverName, ServerForUpdate parameters) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return beginUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); } @@ -685,7 +670,7 @@ public SyncPoller, ServerInner> beginUpdate( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerInner> beginUpdate( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { return beginUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); } @@ -702,7 +687,8 @@ public SyncPoller, ServerInner> beginUpdate( * @return represents a server on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String serverName, ServerForUpdate parameters) { + private Mono updateAsync( + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return beginUpdateAsync(resourceGroupName, serverName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); @@ -723,7 +709,7 @@ private Mono updateAsync(String resourceGroupName, String serverNam */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { return beginUpdateAsync(resourceGroupName, serverName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); @@ -742,7 +728,7 @@ private Mono updateAsync( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerInner update(String resourceGroupName, String serverName, ServerForUpdate parameters) { + public ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return updateAsync(resourceGroupName, serverName, parameters).block(); } @@ -761,7 +747,7 @@ public ServerInner update(String resourceGroupName, String serverName, ServerFor */ @ServiceMethod(returns = ReturnType.SINGLE) public ServerInner update( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { return updateAsync(resourceGroupName, serverName, parameters, context).block(); } @@ -796,6 +782,7 @@ private Mono>> deleteWithResponseAsync(String resource if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -803,7 +790,7 @@ private Mono>> deleteWithResponseAsync(String resource service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -845,12 +832,13 @@ private Mono>> deleteWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1024,6 +1012,7 @@ private Mono> getByResourceGroupWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1031,7 +1020,7 @@ private Mono> getByResourceGroupWithResponseAsync( service .getByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1073,12 +1062,13 @@ private Mono> getByResourceGroupWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .getByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1099,14 +1089,7 @@ private Mono> getByResourceGroupWithResponseAsync( @ServiceMethod(returns = ReturnType.SINGLE) private Mono getByResourceGroupAsync(String resourceGroupName, String serverName) { return getByResourceGroupWithResponseAsync(resourceGroupName, serverName) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -1168,6 +1151,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1175,7 +1159,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri service .listByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, accept, @@ -1183,12 +1167,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -1221,12 +1200,13 @@ private Mono> listByResourceGroupSinglePageAsync( return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, accept, @@ -1234,12 +1214,7 @@ private Mono> listByResourceGroupSinglePageAsync( .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -1253,9 +1228,7 @@ private Mono> listByResourceGroupSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); } /** @@ -1270,9 +1243,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGroupName */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); } /** @@ -1325,26 +1296,17 @@ private Mono> listSinglePageAsync() { new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .list( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, - context)) + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -1371,24 +1333,15 @@ private Mono> listSinglePageAsync(Context context) { new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, - context) + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -1400,7 +1353,7 @@ private Mono> listSinglePageAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listSinglePageAsync()); } /** @@ -1414,8 +1367,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listSinglePageAsync(context)); } /** @@ -1445,7 +1397,7 @@ public PagedIterable list(Context context) { } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1455,7 +1407,7 @@ public PagedIterable list(Context context) { * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> failoverWithResponseAsync(String resourceGroupName, String serverName) { + private Mono>> restartWithResponseAsync(String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1475,14 +1427,15 @@ private Mono>> failoverWithResponseAsync(String resour if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .failover( + .restart( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1492,7 +1445,7 @@ private Mono>> failoverWithResponseAsync(String resour } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1503,7 +1456,7 @@ private Mono>> failoverWithResponseAsync(String resour * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> failoverWithResponseAsync( + private Mono>> restartWithResponseAsync( String resourceGroupName, String serverName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1524,12 +1477,13 @@ private Mono>> failoverWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .failover( + .restart( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1538,7 +1492,7 @@ private Mono>> failoverWithResponseAsync( } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1548,8 +1502,8 @@ private Mono>> failoverWithResponseAsync( * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginFailoverAsync(String resourceGroupName, String serverName) { - Mono>> mono = failoverWithResponseAsync(resourceGroupName, serverName); + private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String serverName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName); return this .client .getLroResult( @@ -1557,7 +1511,7 @@ private PollerFlux, Void> beginFailoverAsync(String resourceGro } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1568,17 +1522,17 @@ private PollerFlux, Void> beginFailoverAsync(String resourceGro * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginFailoverAsync( + private PollerFlux, Void> beginRestartAsync( String resourceGroupName, String serverName, Context context) { context = this.client.mergeContext(context); - Mono>> mono = failoverWithResponseAsync(resourceGroupName, serverName, context); + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName, context); return this .client .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1588,12 +1542,12 @@ private PollerFlux, Void> beginFailoverAsync( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginFailover(String resourceGroupName, String serverName) { - return beginFailoverAsync(resourceGroupName, serverName).getSyncPoller(); + public SyncPoller, Void> beginRestart(String resourceGroupName, String serverName) { + return beginRestartAsync(resourceGroupName, serverName).getSyncPoller(); } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1604,13 +1558,13 @@ public SyncPoller, Void> beginFailover(String resourceGroupName * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginFailover( + public SyncPoller, Void> beginRestart( String resourceGroupName, String serverName, Context context) { - return beginFailoverAsync(resourceGroupName, serverName, context).getSyncPoller(); + return beginRestartAsync(resourceGroupName, serverName, context).getSyncPoller(); } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1620,12 +1574,12 @@ public SyncPoller, Void> beginFailover( * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono failoverAsync(String resourceGroupName, String serverName) { - return beginFailoverAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + private Mono restartAsync(String resourceGroupName, String serverName) { + return beginRestartAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1636,14 +1590,14 @@ private Mono failoverAsync(String resourceGroupName, String serverName) { * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono failoverAsync(String resourceGroupName, String serverName, Context context) { - return beginFailoverAsync(resourceGroupName, serverName, context) + private Mono restartAsync(String resourceGroupName, String serverName, Context context) { + return beginRestartAsync(resourceGroupName, serverName, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1652,12 +1606,12 @@ private Mono failoverAsync(String resourceGroupName, String serverName, Co * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void failover(String resourceGroupName, String serverName) { - failoverAsync(resourceGroupName, serverName).block(); + public void restart(String resourceGroupName, String serverName) { + restartAsync(resourceGroupName, serverName).block(); } /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1667,24 +1621,22 @@ public void failover(String resourceGroupName, String serverName) { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void failover(String resourceGroupName, String serverName, Context context) { - failoverAsync(resourceGroupName, serverName, context).block(); + public void restart(String resourceGroupName, String serverName, Context context) { + restartAsync(resourceGroupName, serverName, context).block(); } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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 {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> restartWithResponseAsync( - String resourceGroupName, String serverName, ServerRestartParameter parameters) { + private Mono>> startWithResponseAsync(String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1704,34 +1656,28 @@ private Mono>> restartWithResponseAsync( 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 apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .restart( + .start( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, - parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. @@ -1739,8 +1685,8 @@ private Mono>> restartWithResponseAsync( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> restartWithResponseAsync( - String resourceGroupName, String serverName, ServerRestartParameter parameters, Context context) { + private Mono>> startWithResponseAsync( + String resourceGroupName, String serverName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1760,40 +1706,33 @@ private Mono>> restartWithResponseAsync( 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 apiVersion = "2020-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .restart( + .start( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, - parameters, accept, context); } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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 {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginRestartAsync( - String resourceGroupName, String serverName, ServerRestartParameter parameters) { - Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName, parameters); + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String serverName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, serverName); return this .client .getLroResult( @@ -1801,11 +1740,10 @@ private PollerFlux, Void> beginRestartAsync( } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. @@ -1813,39 +1751,35 @@ private PollerFlux, Void> beginRestartAsync( * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginRestartAsync( - String resourceGroupName, String serverName, ServerRestartParameter parameters, Context context) { + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String serverName, Context context) { context = this.client.mergeContext(context); - Mono>> mono = - restartWithResponseAsync(resourceGroupName, serverName, parameters, context); + Mono>> mono = startWithResponseAsync(resourceGroupName, serverName, context); return this .client .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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 {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, ServerRestartParameter parameters) { - return beginRestartAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + public SyncPoller, Void> beginStart(String resourceGroupName, String serverName) { + return beginStartAsync(resourceGroupName, serverName).getSyncPoller(); } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. @@ -1853,35 +1787,30 @@ public SyncPoller, Void> beginRestart( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, ServerRestartParameter parameters, Context context) { - return beginRestartAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + public SyncPoller, Void> beginStart(String resourceGroupName, String serverName, Context context) { + return beginStartAsync(resourceGroupName, serverName, context).getSyncPoller(); } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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 {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono restartAsync(String resourceGroupName, String serverName, ServerRestartParameter parameters) { - return beginRestartAsync(resourceGroupName, serverName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + private Mono startAsync(String resourceGroupName, String serverName) { + return beginStartAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. @@ -1889,47 +1818,43 @@ private Mono restartAsync(String resourceGroupName, String serverName, Ser * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono restartAsync( - String resourceGroupName, String serverName, ServerRestartParameter parameters, Context context) { - return beginRestartAsync(resourceGroupName, serverName, parameters, context) + private Mono startAsync(String resourceGroupName, String serverName, Context context) { + return beginStartAsync(resourceGroupName, serverName, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void restart(String resourceGroupName, String serverName, ServerRestartParameter parameters) { - restartAsync(resourceGroupName, serverName, parameters).block(); + public void start(String resourceGroupName, String serverName) { + startAsync(resourceGroupName, serverName).block(); } /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void restart( - String resourceGroupName, String serverName, ServerRestartParameter parameters, Context context) { - restartAsync(resourceGroupName, serverName, parameters, context).block(); + public void start(String resourceGroupName, String serverName, Context context) { + startAsync(resourceGroupName, serverName, context).block(); } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1939,7 +1864,7 @@ public void restart( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> startWithResponseAsync(String resourceGroupName, String serverName) { + private Mono>> stopWithResponseAsync(String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1959,14 +1884,15 @@ private Mono>> startWithResponseAsync(String resourceG if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .start( + .stop( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1976,7 +1902,7 @@ private Mono>> startWithResponseAsync(String resourceG } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1987,7 +1913,7 @@ private Mono>> startWithResponseAsync(String resourceG * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> startWithResponseAsync( + private Mono>> stopWithResponseAsync( String resourceGroupName, String serverName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -2008,12 +1934,13 @@ private Mono>> startWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2020-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .start( + .stop( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -2022,7 +1949,7 @@ private Mono>> startWithResponseAsync( } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -2032,8 +1959,8 @@ private Mono>> startWithResponseAsync( * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStartAsync(String resourceGroupName, String serverName) { - Mono>> mono = startWithResponseAsync(resourceGroupName, serverName); + private PollerFlux, Void> beginStopAsync(String resourceGroupName, String serverName) { + Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName); return this .client .getLroResult( @@ -2041,7 +1968,7 @@ private PollerFlux, Void> beginStartAsync(String resourceGroupN } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -2052,17 +1979,17 @@ private PollerFlux, Void> beginStartAsync(String resourceGroupN * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStartAsync( + private PollerFlux, Void> beginStopAsync( String resourceGroupName, String serverName, Context context) { context = this.client.mergeContext(context); - Mono>> mono = startWithResponseAsync(resourceGroupName, serverName, context); + Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName, context); return this .client .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -2072,12 +1999,12 @@ private PollerFlux, Void> beginStartAsync( * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStart(String resourceGroupName, String serverName) { - return beginStartAsync(resourceGroupName, serverName).getSyncPoller(); + public SyncPoller, Void> beginStop(String resourceGroupName, String serverName) { + return beginStopAsync(resourceGroupName, serverName).getSyncPoller(); } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -2088,12 +2015,12 @@ public SyncPoller, Void> beginStart(String resourceGroupName, S * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStart(String resourceGroupName, String serverName, Context context) { - return beginStartAsync(resourceGroupName, serverName, context).getSyncPoller(); + public SyncPoller, Void> beginStop(String resourceGroupName, String serverName, Context context) { + return beginStopAsync(resourceGroupName, serverName, context).getSyncPoller(); } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -2103,12 +2030,12 @@ public SyncPoller, Void> beginStart(String resourceGroupName, S * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono startAsync(String resourceGroupName, String serverName) { - return beginStartAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + private Mono stopAsync(String resourceGroupName, String serverName) { + return beginStopAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -2119,14 +2046,14 @@ private Mono startAsync(String resourceGroupName, String serverName) { * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono startAsync(String resourceGroupName, String serverName, Context context) { - return beginStartAsync(resourceGroupName, serverName, context) + private Mono stopAsync(String resourceGroupName, String serverName, Context context) { + return beginStopAsync(resourceGroupName, serverName, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -2135,12 +2062,12 @@ private Mono startAsync(String resourceGroupName, String serverName, Conte * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void start(String resourceGroupName, String serverName) { - startAsync(resourceGroupName, serverName).block(); + public void stop(String resourceGroupName, String serverName) { + stopAsync(resourceGroupName, serverName).block(); } /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -2150,22 +2077,24 @@ public void start(String resourceGroupName, String serverName) { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void start(String resourceGroupName, String serverName, Context context) { - startAsync(resourceGroupName, serverName, context).block(); + public void stop(String resourceGroupName, String serverName, Context context) { + stopAsync(resourceGroupName, serverName, context).block(); } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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 {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> stopWithResponseAsync(String resourceGroupName, String serverName) { + private Mono>> upgradeWithResponseAsync( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -2185,27 +2114,35 @@ private Mono>> stopWithResponseAsync(String resourceGr 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 apiVersion = "2020-01-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .stop( + .upgrade( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, + parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. @@ -2213,8 +2150,8 @@ private Mono>> stopWithResponseAsync(String resourceGr * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> stopWithResponseAsync( - String resourceGroupName, String serverName, Context context) { + private Mono>> upgradeWithResponseAsync( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -2234,32 +2171,41 @@ private Mono>> stopWithResponseAsync( 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 apiVersion = "2020-01-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .stop( + .upgrade( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, + parameters, accept, context); } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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 {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStopAsync(String resourceGroupName, String serverName) { - Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName); + private PollerFlux, Void> beginUpgradeAsync( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters) { + Mono>> mono = upgradeWithResponseAsync(resourceGroupName, serverName, parameters); return this .client .getLroResult( @@ -2267,10 +2213,11 @@ private PollerFlux, Void> beginStopAsync(String resourceGroupNa } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. @@ -2278,35 +2225,39 @@ private PollerFlux, Void> beginStopAsync(String resourceGroupNa * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStopAsync( - String resourceGroupName, String serverName, Context context) { + private PollerFlux, Void> beginUpgradeAsync( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters, Context context) { context = this.client.mergeContext(context); - Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName, context); + Mono>> mono = + upgradeWithResponseAsync(resourceGroupName, serverName, parameters, context); return this .client .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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 {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStop(String resourceGroupName, String serverName) { - return beginStopAsync(resourceGroupName, serverName).getSyncPoller(); + public SyncPoller, Void> beginUpgrade( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters) { + return beginUpgradeAsync(resourceGroupName, serverName, parameters).getSyncPoller(); } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. @@ -2314,30 +2265,35 @@ public SyncPoller, Void> beginStop(String resourceGroupName, St * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStop(String resourceGroupName, String serverName, Context context) { - return beginStopAsync(resourceGroupName, serverName, context).getSyncPoller(); + public SyncPoller, Void> beginUpgrade( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters, Context context) { + return beginUpgradeAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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 {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono stopAsync(String resourceGroupName, String serverName) { - return beginStopAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + private Mono upgradeAsync(String resourceGroupName, String serverName, ServerUpgradeParameters parameters) { + return beginUpgradeAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. @@ -2345,181 +2301,42 @@ private Mono stopAsync(String resourceGroupName, String serverName) { * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono stopAsync(String resourceGroupName, String serverName, Context context) { - return beginStopAsync(resourceGroupName, serverName, context) + private Mono upgradeAsync( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters, Context context) { + return beginUpgradeAsync(resourceGroupName, serverName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void stop(String resourceGroupName, String serverName) { - stopAsync(resourceGroupName, serverName).block(); + public void upgrade(String resourceGroupName, String serverName, ServerUpgradeParameters parameters) { + upgradeAsync(resourceGroupName, serverName, parameters).block(); } /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void stop(String resourceGroupName, String serverName, Context context) { - stopAsync(resourceGroupName, serverName, context).block(); - } - - /** - * Get the next page of items. - * - * @param nextLink 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 servers along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The 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 servers along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink 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 servers 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 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 servers 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)); + public void upgrade( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters, Context context) { + upgradeAsync(resourceGroupName, serverName, parameters, context).block(); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServersImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServersImpl.java index 1dfcdf5c8d560..478f500c3ebc0 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServersImpl.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/ServersImpl.java @@ -12,7 +12,7 @@ import com.azure.resourcemanager.mysqlflexibleserver.fluent.ServersClient; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerInner; import com.azure.resourcemanager.mysqlflexibleserver.models.Server; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerRestartParameter; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerUpgradeParameters; import com.azure.resourcemanager.mysqlflexibleserver.models.Servers; public final class ServersImpl implements Servers { @@ -80,21 +80,12 @@ public PagedIterable list(Context context) { return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); } - public void failover(String resourceGroupName, String serverName) { - this.serviceClient().failover(resourceGroupName, serverName); + public void restart(String resourceGroupName, String serverName) { + this.serviceClient().restart(resourceGroupName, serverName); } - public void failover(String resourceGroupName, String serverName, Context context) { - this.serviceClient().failover(resourceGroupName, serverName, context); - } - - public void restart(String resourceGroupName, String serverName, ServerRestartParameter parameters) { - this.serviceClient().restart(resourceGroupName, serverName, parameters); - } - - public void restart( - String resourceGroupName, String serverName, ServerRestartParameter parameters, Context context) { - this.serviceClient().restart(resourceGroupName, serverName, parameters, context); + public void restart(String resourceGroupName, String serverName, Context context) { + this.serviceClient().restart(resourceGroupName, serverName, context); } public void start(String resourceGroupName, String serverName) { @@ -113,6 +104,15 @@ public void stop(String resourceGroupName, String serverName, Context context) { this.serviceClient().stop(resourceGroupName, serverName, context); } + public void upgrade(String resourceGroupName, String serverName, ServerUpgradeParameters parameters) { + this.serviceClient().upgrade(resourceGroupName, serverName, parameters); + } + + public void upgrade( + String resourceGroupName, String serverName, ServerUpgradeParameters parameters, Context context) { + this.serviceClient().upgrade(resourceGroupName, serverName, parameters, context); + } + public Server getById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { @@ -122,13 +122,12 @@ public Server getById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); } @@ -142,13 +141,12 @@ public Response getByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, serverName, context); } @@ -162,13 +160,12 @@ public void deleteById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } this.delete(resourceGroupName, serverName, Context.NONE); } @@ -182,13 +179,12 @@ public void deleteByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } this.delete(resourceGroupName, serverName, context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/TopQueryStatisticsClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/TopQueryStatisticsClientImpl.java new file mode 100644 index 0000000000000..3fd79971d7860 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/TopQueryStatisticsClientImpl.java @@ -0,0 +1,535 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +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.mysqlflexibleserver.fluent.TopQueryStatisticsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryStatisticInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.TopQueryStatisticsInput; +import com.azure.resourcemanager.mysqlflexibleserver.models.TopQueryStatisticsResultList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TopQueryStatisticsClient. */ +public final class TopQueryStatisticsClientImpl implements TopQueryStatisticsClient { + /** The proxy service used to perform REST calls. */ + private final TopQueryStatisticsService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of TopQueryStatisticsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TopQueryStatisticsClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy.create(TopQueryStatisticsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientTopQueryStatistics to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface TopQueryStatisticsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/topQueryStatistics/{queryStatisticId}") + @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("queryStatisticId") String queryStatisticId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/topQueryStatistics") + @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, + @BodyParam("application/json") TopQueryStatisticsInput parameters, + @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); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Statistic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String queryStatisticId) { + 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 (queryStatisticId == null) { + return Mono + .error(new IllegalArgumentException("Parameter queryStatisticId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryStatisticId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @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 Query Statistic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String queryStatisticId, 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 (queryStatisticId == null) { + return Mono + .error(new IllegalArgumentException("Parameter queryStatisticId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryStatisticId, + accept, + context); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Statistic on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String queryStatisticId) { + return getWithResponseAsync(resourceGroupName, serverName, queryStatisticId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryStatisticInner get(String resourceGroupName, String serverName, String queryStatisticId) { + return getAsync(resourceGroupName, serverName, queryStatisticId).block(); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @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 Query Statistic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String queryStatisticId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, queryStatisticId, context).block(); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 query statistics along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, TopQueryStatisticsInput 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 apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + 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())); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @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 query statistics along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, TopQueryStatisticsInput 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 apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 query statistics as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, parameters), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @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 query statistics as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, parameters, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 query statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, parameters)); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @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 query statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, parameters, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 query statistics 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 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 query statistics 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/TopQueryStatisticsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/TopQueryStatisticsImpl.java new file mode 100644 index 0000000000000..9d1452b551384 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/TopQueryStatisticsImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.TopQueryStatisticsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryStatisticInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.QueryStatistic; +import com.azure.resourcemanager.mysqlflexibleserver.models.TopQueryStatistics; +import com.azure.resourcemanager.mysqlflexibleserver.models.TopQueryStatisticsInput; + +public final class TopQueryStatisticsImpl implements TopQueryStatistics { + private static final ClientLogger LOGGER = new ClientLogger(TopQueryStatisticsImpl.class); + + private final TopQueryStatisticsClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public TopQueryStatisticsImpl( + TopQueryStatisticsClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public QueryStatistic get(String resourceGroupName, String serverName, String queryStatisticId) { + QueryStatisticInner inner = this.serviceClient().get(resourceGroupName, serverName, queryStatisticId); + if (inner != null) { + return new QueryStatisticImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String queryStatisticId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, queryStatisticId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QueryStatisticImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, parameters); + return Utils.mapPage(inner, inner1 -> new QueryStatisticImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, parameters, context); + return Utils.mapPage(inner, inner1 -> new QueryStatisticImpl(inner1, this.manager())); + } + + private TopQueryStatisticsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkRuleImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkRuleImpl.java new file mode 100644 index 0000000000000..17bff01423e5e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkRuleImpl.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkRule; +import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkRuleState; + +public final class VirtualNetworkRuleImpl + implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { + private VirtualNetworkRuleInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String virtualNetworkSubnetId() { + return this.innerModel().virtualNetworkSubnetId(); + } + + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.innerModel().ignoreMissingVnetServiceEndpoint(); + } + + public VirtualNetworkRuleState state() { + return this.innerModel().state(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public VirtualNetworkRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String virtualNetworkRuleName; + + public VirtualNetworkRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public VirtualNetworkRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl(String name, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = new VirtualNetworkRuleInner(); + this.serviceManager = serviceManager; + this.virtualNetworkRuleName = name; + } + + public VirtualNetworkRuleImpl update() { + return this; + } + + public VirtualNetworkRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl( + VirtualNetworkRuleInner innerObject, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.virtualNetworkRuleName = Utils.getValueFromIdByName(innerObject.id(), "virtualNetworkRules"); + } + + public VirtualNetworkRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE) + .getValue(); + return this; + } + + public VirtualNetworkRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context) + .getValue(); + return this; + } + + public VirtualNetworkRuleImpl withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.innerModel().withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return this; + } + + public VirtualNetworkRuleImpl withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.innerModel().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkRulesClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkRulesClientImpl.java new file mode 100644 index 0000000000000..fff1be67fd518 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkRulesClientImpl.java @@ -0,0 +1,1147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkRuleListResult; +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 VirtualNetworkRulesClient. */ +public final class VirtualNetworkRulesClientImpl implements VirtualNetworkRulesClient { + /** The proxy service used to perform REST calls. */ + private final VirtualNetworkRulesService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworkRulesClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy.create(VirtualNetworkRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientVirtualNetworkRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface VirtualNetworkRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @BodyParam("application/json") VirtualNetworkRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/virtualNetworkRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @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 a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + accept, + context); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName 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 apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + parameters, + accept, + context); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + this.client.getContext()); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + context); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).block(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context).block(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).getSyncPoller(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).getSyncPoller(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * Gets a list of virtual network rules in a 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 virtual network rules in a 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 (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 a list of virtual network rules in a 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 virtual network rules in a 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 (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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of virtual network rules in a 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 virtual network rules in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of virtual network rules in a 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 virtual network rules in a 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 a list of virtual network rules in a 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 virtual network rules in a 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 a list of virtual network rules in a 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 virtual network rules in a 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 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 virtual network rules 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 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 virtual network rules 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkRulesImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkRulesImpl.java new file mode 100644 index 0000000000000..9621e25ef0df4 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/VirtualNetworkRulesImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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.mysqlflexibleserver.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkRule; +import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkRules; + +public final class VirtualNetworkRulesImpl implements VirtualNetworkRules { + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkRulesImpl.class); + + private final VirtualNetworkRulesClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public VirtualNetworkRulesImpl( + VirtualNetworkRulesClient innerClient, + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + VirtualNetworkRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, virtualNetworkRuleName); + if (inner != null) { + return new VirtualNetworkRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualNetworkRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName); + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(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 VirtualNetworkRuleImpl(inner1, this.manager())); + } + + public VirtualNetworkRule getById(String 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + public void deleteById(String 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + private VirtualNetworkRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } + + public VirtualNetworkRuleImpl define(String name) { + return new VirtualNetworkRuleImpl(name, this.manager()); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/WaitStatisticImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/WaitStatisticImpl.java new file mode 100644 index 0000000000000..94a572c2e91c8 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/WaitStatisticImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.WaitStatisticInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatistic; +import java.time.OffsetDateTime; + +public final class WaitStatisticImpl implements WaitStatistic { + private WaitStatisticInner innerObject; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + WaitStatisticImpl( + WaitStatisticInner innerObject, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager 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 OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String eventName() { + return this.innerModel().eventName(); + } + + public String eventTypeName() { + return this.innerModel().eventTypeName(); + } + + public Long queryId() { + return this.innerModel().queryId(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public Long userId() { + return this.innerModel().userId(); + } + + public Long count() { + return this.innerModel().count(); + } + + public Double totalTimeInMs() { + return this.innerModel().totalTimeInMs(); + } + + public WaitStatisticInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/WaitStatisticsClientImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/WaitStatisticsClientImpl.java new file mode 100644 index 0000000000000..77c455c8dc171 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/WaitStatisticsClientImpl.java @@ -0,0 +1,535 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +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.mysqlflexibleserver.fluent.WaitStatisticsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.WaitStatisticInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatisticsInput; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatisticsResultList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WaitStatisticsClient. */ +public final class WaitStatisticsClientImpl implements WaitStatisticsClient { + /** The proxy service used to perform REST calls. */ + private final WaitStatisticsService service; + + /** The service client containing this operation class. */ + private final MySqlManagementClientImpl client; + + /** + * Initializes an instance of WaitStatisticsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WaitStatisticsClientImpl(MySqlManagementClientImpl client) { + this.service = + RestProxy.create(WaitStatisticsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MySqlManagementClientWaitStatistics to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MySqlManagementClien") + private interface WaitStatisticsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/waitStatistics/{waitStatisticsId}") + @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("waitStatisticsId") String waitStatisticsId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers" + + "/{serverName}/waitStatistics") + @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, + @BodyParam("application/json") WaitStatisticsInput parameters, + @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); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Wait Statistic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String waitStatisticsId) { + 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 (waitStatisticsId == null) { + return Mono + .error(new IllegalArgumentException("Parameter waitStatisticsId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + waitStatisticsId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @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 Wait Statistic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String waitStatisticsId, 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 (waitStatisticsId == null) { + return Mono + .error(new IllegalArgumentException("Parameter waitStatisticsId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + waitStatisticsId, + accept, + context); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Wait Statistic on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String waitStatisticsId) { + return getWithResponseAsync(resourceGroupName, serverName, waitStatisticsId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Wait Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WaitStatisticInner get(String resourceGroupName, String serverName, String waitStatisticsId) { + return getAsync(resourceGroupName, serverName, waitStatisticsId).block(); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @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 Wait Statistic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String waitStatisticsId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, waitStatisticsId, context).block(); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 wait statistics along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, WaitStatisticsInput 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 apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + 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())); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @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 wait statistics along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, WaitStatisticsInput 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 apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 wait statistics as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, WaitStatisticsInput parameters) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, parameters), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @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 wait statistics as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, parameters, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 wait statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, parameters)); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @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 wait statistics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, parameters, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 wait statistics 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 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 wait statistics 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/WaitStatisticsImpl.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/WaitStatisticsImpl.java new file mode 100644 index 0000000000000..6b095be176102 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/implementation/WaitStatisticsImpl.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.mysqlflexibleserver.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.mysqlflexibleserver.fluent.WaitStatisticsClient; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.WaitStatisticInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatistic; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatistics; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatisticsInput; + +public final class WaitStatisticsImpl implements WaitStatistics { + private static final ClientLogger LOGGER = new ClientLogger(WaitStatisticsImpl.class); + + private final WaitStatisticsClient innerClient; + + private final com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager; + + public WaitStatisticsImpl( + WaitStatisticsClient innerClient, com.azure.resourcemanager.mysqlflexibleserver.MySqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public WaitStatistic get(String resourceGroupName, String serverName, String waitStatisticsId) { + WaitStatisticInner inner = this.serviceClient().get(resourceGroupName, serverName, waitStatisticsId); + if (inner != null) { + return new WaitStatisticImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String waitStatisticsId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, waitStatisticsId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WaitStatisticImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, parameters); + return Utils.mapPage(inner, inner1 -> new WaitStatisticImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, parameters, context); + return Utils.mapPage(inner, inner1 -> new WaitStatisticImpl(inner1, this.manager())); + } + + private WaitStatisticsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ManagedServiceIdentityType.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/AdministratorType.java similarity index 51% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ManagedServiceIdentityType.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/AdministratorType.java index e235d420aa97f..1cec3a620f5a3 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ManagedServiceIdentityType.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/AdministratorType.java @@ -7,28 +7,28 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for ManagedServiceIdentityType. */ -public enum ManagedServiceIdentityType { - /** Enum value UserAssigned. */ - USER_ASSIGNED("UserAssigned"); +/** Defines values for AdministratorType. */ +public enum AdministratorType { + /** Enum value ActiveDirectory. */ + ACTIVE_DIRECTORY("ActiveDirectory"); - /** The actual serialized value for a ManagedServiceIdentityType instance. */ + /** The actual serialized value for a AdministratorType instance. */ private final String value; - ManagedServiceIdentityType(String value) { + AdministratorType(String value) { this.value = value; } /** - * Parses a serialized value to a ManagedServiceIdentityType instance. + * Parses a serialized value to a AdministratorType instance. * * @param value the serialized value to parse. - * @return the parsed ManagedServiceIdentityType object, or null if unable to parse. + * @return the parsed AdministratorType object, or null if unable to parse. */ @JsonCreator - public static ManagedServiceIdentityType fromString(String value) { - ManagedServiceIdentityType[] items = ManagedServiceIdentityType.values(); - for (ManagedServiceIdentityType item : items) { + public static AdministratorType fromString(String value) { + AdministratorType[] items = AdministratorType.values(); + for (AdministratorType item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Advisor.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Advisor.java new file mode 100644 index 0000000000000..6f65eece37291 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Advisor.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.AdvisorInner; + +/** An immutable client-side representation of Advisor. */ +public interface Advisor { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The properties of a recommendation action advisor. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.AdvisorInner object. + * + * @return the inner object. + */ + AdvisorInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Backups.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Advisors.java similarity index 68% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Backups.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Advisors.java index 6ea5181f4f4c7..d2b009a83f176 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Backups.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Advisors.java @@ -8,50 +8,49 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of Backups. */ -public interface Backups { +/** Resource collection API of Advisors. */ +public interface Advisors { /** - * List all the backups for a given server. + * Get a recommendation action advisor. * * @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 advisorName The advisor name for recommendation action. * @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 server backup properties. + * @return a recommendation action advisor. */ - ServerBackup get(String resourceGroupName, String serverName, String backupName); + Advisor get(String resourceGroupName, String serverName, String advisorName); /** - * List all the backups for a given server. + * Get a recommendation action advisor. * * @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 advisorName The advisor name for recommendation action. * @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 server backup properties along with {@link Response}. + * @return a recommendation action advisor along with {@link Response}. */ - Response getWithResponse( - String resourceGroupName, String serverName, String backupName, Context context); + Response getWithResponse(String resourceGroupName, String serverName, String advisorName, Context context); /** - * List all the backups for a given server. + * List recommendation action advisors. * * @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 server backups as paginated response with {@link PagedIterable}. + * @return a list of query statistics as paginated response with {@link PagedIterable}. */ - PagedIterable listByServer(String resourceGroupName, String serverName); + PagedIterable listByServer(String resourceGroupName, String serverName); /** - * List all the backups for a given server. + * List recommendation action advisors. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -59,7 +58,7 @@ Response getWithResponse( * @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 server backups as paginated response with {@link PagedIterable}. + * @return a list of query statistics as paginated response with {@link PagedIterable}. */ - PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/AdvisorsResultList.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/AdvisorsResultList.java new file mode 100644 index 0000000000000..5927379da46be --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/AdvisorsResultList.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.AdvisorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of query statistics. */ +@Immutable +public final class AdvisorsResultList { + /* + * The list of recommendation action advisors. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of recommendation action advisors. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Backup.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Backup.java deleted file mode 100644 index 375f790d04e2a..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Backup.java +++ /dev/null @@ -1,88 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** Storage Profile properties of a server. */ -@Fluent -public final class Backup { - /* - * Backup retention days for the server. - */ - @JsonProperty(value = "backupRetentionDays") - private Integer backupRetentionDays; - - /* - * Whether or not geo redundant backup is enabled. - */ - @JsonProperty(value = "geoRedundantBackup") - private EnableStatusEnum geoRedundantBackup; - - /* - * Earliest restore point creation time (ISO8601 format) - */ - @JsonProperty(value = "earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime earliestRestoreDate; - - /** - * Get the backupRetentionDays property: Backup retention days for the server. - * - * @return the backupRetentionDays value. - */ - public Integer backupRetentionDays() { - return this.backupRetentionDays; - } - - /** - * Set the backupRetentionDays property: Backup retention days for the server. - * - * @param backupRetentionDays the backupRetentionDays value to set. - * @return the Backup object itself. - */ - public Backup withBackupRetentionDays(Integer backupRetentionDays) { - this.backupRetentionDays = backupRetentionDays; - return this; - } - - /** - * Get the geoRedundantBackup property: Whether or not geo redundant backup is enabled. - * - * @return the geoRedundantBackup value. - */ - public EnableStatusEnum geoRedundantBackup() { - return this.geoRedundantBackup; - } - - /** - * Set the geoRedundantBackup property: Whether or not geo redundant backup is enabled. - * - * @param geoRedundantBackup the geoRedundantBackup value to set. - * @return the Backup object itself. - */ - public Backup withGeoRedundantBackup(EnableStatusEnum geoRedundantBackup) { - this.geoRedundantBackup = geoRedundantBackup; - return this; - } - - /** - * Get the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). - * - * @return the earliestRestoreDate value. - */ - public OffsetDateTime earliestRestoreDate() { - return this.earliestRestoreDate; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CapabilityProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CapabilityProperties.java deleted file mode 100644 index 5890e95962156..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CapabilityProperties.java +++ /dev/null @@ -1,46 +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.mysqlflexibleserver.models; - -import com.azure.resourcemanager.mysqlflexibleserver.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 supportedGeoBackupRegions property: supported geo backup regions. - * - * @return the supportedGeoBackupRegions value. - */ - List supportedGeoBackupRegions(); - - /** - * Gets the supportedFlexibleServerEditions property: A list of supported flexible server editions. - * - * @return the supportedFlexibleServerEditions value. - */ - List supportedFlexibleServerEditions(); - - /** - * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.CapabilityPropertiesInner object. - * - * @return the inner object. - */ - CapabilityPropertiesInner innerModel(); -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CheckNameAvailabilities.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CheckNameAvailabilities.java index ecf2ed62a0d30..20a5ef5a80913 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CheckNameAvailabilities.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CheckNameAvailabilities.java @@ -10,28 +10,25 @@ /** Resource collection API of CheckNameAvailabilities. */ public interface CheckNameAvailabilities { /** - * Check the availability of name for server. + * Check the availability of name for resource. * - * @param locationName The name of the location. - * @param nameAvailabilityRequest The required parameters for checking if server name is available. + * @param nameAvailabilityRequest The required parameters for checking if resource 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 resource name availability. */ - NameAvailability execute(String locationName, NameAvailabilityRequest nameAvailabilityRequest); + NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest); /** - * Check the availability of name for server. + * Check the availability of name for resource. * - * @param locationName The name of the location. - * @param nameAvailabilityRequest The required parameters for checking if server name is available. + * @param nameAvailabilityRequest The required parameters for checking if resource 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 resource name availability along with {@link Response}. */ - Response executeWithResponse( - String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context); + Response executeWithResponse(NameAvailabilityRequest nameAvailabilityRequest, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Configuration.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Configuration.java index 78e62044cf8ac..85c1095e4d2a3 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Configuration.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Configuration.java @@ -4,7 +4,7 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; -import com.azure.core.management.SystemData; +import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner; /** An immutable client-side representation of Configuration. */ @@ -30,13 +30,6 @@ public interface Configuration { */ String type(); - /** - * Gets the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the value property: Value of the configuration. * @@ -77,33 +70,142 @@ public interface Configuration { * * @return the source value. */ - ConfigurationSource source(); + String source(); /** - * Gets the isReadOnly property: If is the configuration read only. + * Gets the name of the resource group. * - * @return the isReadOnly value. + * @return the name of the resource group. */ - IsReadOnly isReadOnly(); + String resourceGroupName(); /** - * Gets the isConfigPendingRestart property: If is the configuration pending restart or not. + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner object. * - * @return the isConfigPendingRestart value. + * @return the inner object. */ - IsConfigPendingRestart isConfigPendingRestart(); + ConfigurationInner innerModel(); + /** The entirety of the Configuration definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Configuration definition stages. */ + interface DefinitionStages { + /** The first stage of the Configuration definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Configuration definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the Configuration 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.WithValue, DefinitionStages.WithSource { + /** + * Executes the create request. + * + * @return the created resource. + */ + Configuration create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Configuration create(Context context); + } + /** The stage of the Configuration definition allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: Value of the configuration.. + * + * @param value Value of the configuration. + * @return the next definition stage. + */ + WithCreate withValue(String value); + } + /** The stage of the Configuration definition allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: Source of the configuration.. + * + * @param source Source of the configuration. + * @return the next definition stage. + */ + WithCreate withSource(String source); + } + } /** - * Gets the isDynamicConfig property: If is the configuration dynamic. + * Begins update for the Configuration resource. * - * @return the isDynamicConfig value. + * @return the stage of resource update. */ - IsDynamicConfig isDynamicConfig(); + Configuration.Update update(); + + /** The template for Configuration update. */ + interface Update extends UpdateStages.WithValue, UpdateStages.WithSource { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Configuration apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Configuration apply(Context context); + } + /** The Configuration update stages. */ + interface UpdateStages { + /** The stage of the Configuration update allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: Value of the configuration.. + * + * @param value Value of the configuration. + * @return the next definition stage. + */ + Update withValue(String value); + } + /** The stage of the Configuration update allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: Source of the configuration.. + * + * @param source Source of the configuration. + * @return the next definition stage. + */ + Update withSource(String source); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Configuration refresh(); /** - * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner object. + * Refreshes the resource to sync with Azure. * - * @return the inner object. + * @param context The context to associate with this operation. + * @return the refreshed resource. */ - ConfigurationInner innerModel(); + Configuration refresh(Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationForBatchUpdate.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationForBatchUpdate.java deleted file mode 100644 index 0be6602fdb034..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationForBatchUpdate.java +++ /dev/null @@ -1,111 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationForBatchUpdateProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Represents a Configuration. */ -@Fluent -public final class ConfigurationForBatchUpdate { - /* - * Name of the configuration. - */ - @JsonProperty(value = "name") - private String name; - - /* - * The properties can be updated for a configuration. - */ - @JsonProperty(value = "properties") - private ConfigurationForBatchUpdateProperties innerProperties; - - /** - * Get the name property: Name of the configuration. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: Name of the configuration. - * - * @param name the name value to set. - * @return the ConfigurationForBatchUpdate object itself. - */ - public ConfigurationForBatchUpdate withName(String name) { - this.name = name; - return this; - } - - /** - * Get the innerProperties property: The properties can be updated for a configuration. - * - * @return the innerProperties value. - */ - private ConfigurationForBatchUpdateProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the value property: Value of the configuration. - * - * @return the value value. - */ - public String value() { - return this.innerProperties() == null ? null : this.innerProperties().value(); - } - - /** - * Set the value property: Value of the configuration. - * - * @param value the value value to set. - * @return the ConfigurationForBatchUpdate object itself. - */ - public ConfigurationForBatchUpdate withValue(String value) { - if (this.innerProperties() == null) { - this.innerProperties = new ConfigurationForBatchUpdateProperties(); - } - this.innerProperties().withValue(value); - return this; - } - - /** - * Get the source property: Source of the configuration. - * - * @return the source value. - */ - public String source() { - return this.innerProperties() == null ? null : this.innerProperties().source(); - } - - /** - * Set the source property: Source of the configuration. - * - * @param source the source value to set. - * @return the ConfigurationForBatchUpdate object itself. - */ - public ConfigurationForBatchUpdate withSource(String source) { - if (this.innerProperties() == null) { - this.innerProperties = new ConfigurationForBatchUpdateProperties(); - } - this.innerProperties().withSource(source); - 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationListResult.java index b8a36ce4790ec..3cf586c49edab 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationListResult.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationListResult.java @@ -16,13 +16,6 @@ public interface ConfigurationListResult { */ List value(); - /** - * Gets the nextLink property: The link used to get the next page of operations. - * - * @return the nextLink value. - */ - String nextLink(); - /** * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner object. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationSource.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationSource.java deleted file mode 100644 index 7293dd06256a3..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationSource.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.mysqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ConfigurationSource. */ -public final class ConfigurationSource extends ExpandableStringEnum { - /** Static value system-default for ConfigurationSource. */ - public static final ConfigurationSource SYSTEM_DEFAULT = fromString("system-default"); - - /** Static value user-override for ConfigurationSource. */ - public static final ConfigurationSource USER_OVERRIDE = fromString("user-override"); - - /** - * Creates or finds a ConfigurationSource from its string representation. - * - * @param name a name to look for. - * @return the corresponding ConfigurationSource. - */ - @JsonCreator - public static ConfigurationSource fromString(String name) { - return fromString(name, ConfigurationSource.class); - } - - /** @return known ConfigurationSource values. */ - public static Collection values() { - return values(ConfigurationSource.class); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Configurations.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Configurations.java index 8c95bacd2e99c..1b646929bb338 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Configurations.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Configurations.java @@ -7,45 +7,9 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner; /** Resource collection API of Configurations. */ public interface Configurations { - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @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 Configuration. - */ - Configuration update( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @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 Configuration. - */ - Configuration update( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context); - /** * Gets information about a configuration of server. * @@ -75,56 +39,58 @@ Response getWithResponse( String resourceGroupName, String serverName, String configurationName, Context context); /** - * Update a list of configurations in a given server. + * List all the configurations 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 parameters The parameters for updating a list of server configuration. * @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 server configurations. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ - ConfigurationListResult batchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters); + PagedIterable listByServer(String resourceGroupName, String serverName); /** - * Update a list of configurations in a given server. + * List all the configurations 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 parameters The parameters for updating a list of server configuration. * @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 server configurations. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ - ConfigurationListResult batchUpdate( - String resourceGroupName, String serverName, ConfigurationListForBatchUpdate parameters, Context context); + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); /** - * List all the configurations in a given server. + * Gets information about a configuration of server. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. + * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations as paginated response with {@link PagedIterable}. + * @return information about a configuration of server along with {@link Response}. */ - PagedIterable listByServer(String resourceGroupName, String serverName); + Configuration getById(String id); /** - * List all the configurations in a given server. + * Gets information about a configuration of server. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. + * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations as paginated response with {@link PagedIterable}. + * @return information about a configuration of server along with {@link Response}. */ - PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Configuration resource. + * + * @param name resource name. + * @return the first stage of the new Configuration definition. + */ + Configuration.DefinitionStages.Blank define(String name); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CreateMode.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CreateMode.java index 5a435713ce0da..6c5d3aa0e2c35 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CreateMode.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CreateMode.java @@ -16,12 +16,12 @@ public final class CreateMode extends ExpandableStringEnum { /** Static value PointInTimeRestore for CreateMode. */ public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); - /** Static value Replica for CreateMode. */ - public static final CreateMode REPLICA = fromString("Replica"); - /** Static value GeoRestore for CreateMode. */ public static final CreateMode GEO_RESTORE = fromString("GeoRestore"); + /** Static value Replica for CreateMode. */ + public static final CreateMode REPLICA = fromString("Replica"); + /** * Creates or finds a CreateMode from its string representation. * @@ -33,7 +33,11 @@ public static CreateMode fromString(String name) { return fromString(name, CreateMode.class); } - /** @return known CreateMode values. */ + /** + * Gets known CreateMode values. + * + * @return known CreateMode values. + */ public static Collection values() { return values(CreateMode.class); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DataEncryption.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DataEncryption.java deleted file mode 100644 index 4fe81e09cfe9a..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DataEncryption.java +++ /dev/null @@ -1,157 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The date encryption for cmk. */ -@Fluent -public final class DataEncryption { - /* - * Primary user identity resource id - */ - @JsonProperty(value = "primaryUserAssignedIdentityId") - private String primaryUserAssignedIdentityId; - - /* - * Primary key uri - */ - @JsonProperty(value = "primaryKeyUri") - private String primaryKeyUri; - - /* - * Geo backup user identity resource id as identity can't cross region, - * need identity in same region as geo backup - */ - @JsonProperty(value = "geoBackupUserAssignedIdentityId") - private String geoBackupUserAssignedIdentityId; - - /* - * Geo backup key uri as key vault can't cross region, need cmk in same - * region as geo backup - */ - @JsonProperty(value = "geoBackupKeyUri") - private String geoBackupKeyUri; - - /* - * The key type, AzureKeyVault for enable cmk, SystemManaged for disable - * cmk. - */ - @JsonProperty(value = "type") - private DataEncryptionType type; - - /** - * Get the primaryUserAssignedIdentityId property: Primary user identity resource id. - * - * @return the primaryUserAssignedIdentityId value. - */ - public String primaryUserAssignedIdentityId() { - return this.primaryUserAssignedIdentityId; - } - - /** - * Set the primaryUserAssignedIdentityId property: Primary user identity resource id. - * - * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. - * @return the DataEncryption object itself. - */ - public DataEncryption withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { - this.primaryUserAssignedIdentityId = primaryUserAssignedIdentityId; - return this; - } - - /** - * Get the primaryKeyUri property: Primary key uri. - * - * @return the primaryKeyUri value. - */ - public String primaryKeyUri() { - return this.primaryKeyUri; - } - - /** - * Set the primaryKeyUri property: Primary key uri. - * - * @param primaryKeyUri the primaryKeyUri value to set. - * @return the DataEncryption object itself. - */ - public DataEncryption withPrimaryKeyUri(String primaryKeyUri) { - this.primaryKeyUri = primaryKeyUri; - return this; - } - - /** - * Get the geoBackupUserAssignedIdentityId property: Geo backup user identity resource id as identity can't cross - * region, need identity in same region as geo backup. - * - * @return the geoBackupUserAssignedIdentityId value. - */ - public String geoBackupUserAssignedIdentityId() { - return this.geoBackupUserAssignedIdentityId; - } - - /** - * Set the geoBackupUserAssignedIdentityId property: Geo backup user identity resource id as identity can't cross - * region, need identity in same region as geo backup. - * - * @param geoBackupUserAssignedIdentityId the geoBackupUserAssignedIdentityId value to set. - * @return the DataEncryption object itself. - */ - public DataEncryption withGeoBackupUserAssignedIdentityId(String geoBackupUserAssignedIdentityId) { - this.geoBackupUserAssignedIdentityId = geoBackupUserAssignedIdentityId; - return this; - } - - /** - * Get the geoBackupKeyUri property: Geo backup key uri as key vault can't cross region, need cmk in same region as - * geo backup. - * - * @return the geoBackupKeyUri value. - */ - public String geoBackupKeyUri() { - return this.geoBackupKeyUri; - } - - /** - * Set the geoBackupKeyUri property: Geo backup key uri as key vault can't cross region, need cmk in same region as - * geo backup. - * - * @param geoBackupKeyUri the geoBackupKeyUri value to set. - * @return the DataEncryption object itself. - */ - public DataEncryption withGeoBackupKeyUri(String geoBackupKeyUri) { - this.geoBackupKeyUri = geoBackupKeyUri; - return this; - } - - /** - * Get the type property: The key type, AzureKeyVault for enable cmk, SystemManaged for disable cmk. - * - * @return the type value. - */ - public DataEncryptionType type() { - return this.type; - } - - /** - * Set the type property: The key type, AzureKeyVault for enable cmk, SystemManaged for disable cmk. - * - * @param type the type value to set. - * @return the DataEncryption object itself. - */ - public DataEncryption withType(DataEncryptionType type) { - this.type = type; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Database.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Database.java index 7f240232da6bf..0b021df4067a4 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Database.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Database.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.DatabaseInner; @@ -31,13 +30,6 @@ public interface Database { */ String type(); - /** - * Gets the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the charset property: The charset of the database. * @@ -52,6 +44,13 @@ public interface Database { */ String collation(); + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.DatabaseInner object. * @@ -77,7 +76,7 @@ interface WithParentResource { * @param serverName The name of the server. * @return the next definition stage. */ - WithCreate withExistingFlexibleServer(String resourceGroupName, String serverName); + WithCreate withExistingServer(String resourceGroupName, String serverName); } /** * The stage of the Database definition which contains all the minimum required properties for the resource to diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DatabaseListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DatabaseListResult.java index bb7f1ff791fad..714d7199652a6 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DatabaseListResult.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DatabaseListResult.java @@ -18,12 +18,6 @@ public final class DatabaseListResult { @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - /** * Get the value property: The list of databases housed in a server. * @@ -44,26 +38,6 @@ public DatabaseListResult withValue(List 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 DatabaseListResult object itself. - */ - public DatabaseListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DelegatedSubnetUsage.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DelegatedSubnetUsage.java deleted file mode 100644 index 1aff4d1c1d776..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DelegatedSubnetUsage.java +++ /dev/null @@ -1,50 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Delegated subnet usage data. */ -@Immutable -public final class DelegatedSubnetUsage { - /* - * name of the subnet - */ - @JsonProperty(value = "subnetName", access = JsonProperty.Access.WRITE_ONLY) - private String subnetName; - - /* - * Number of used delegated subnets - */ - @JsonProperty(value = "usage", access = JsonProperty.Access.WRITE_ONLY) - private Long usage; - - /** - * Get the subnetName property: name of the subnet. - * - * @return the subnetName value. - */ - public String subnetName() { - return this.subnetName; - } - - /** - * Get the usage property: Number of used delegated subnets. - * - * @return the usage value. - */ - public Long usage() { - return this.usage; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/EnableStatusEnum.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/EnableStatusEnum.java deleted file mode 100644 index bf066c7a41b93..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/EnableStatusEnum.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.mysqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for EnableStatusEnum. */ -public final class EnableStatusEnum extends ExpandableStringEnum { - /** Static value Enabled for EnableStatusEnum. */ - public static final EnableStatusEnum ENABLED = fromString("Enabled"); - - /** Static value Disabled for EnableStatusEnum. */ - public static final EnableStatusEnum DISABLED = fromString("Disabled"); - - /** - * Creates or finds a EnableStatusEnum from its string representation. - * - * @param name a name to look for. - * @return the corresponding EnableStatusEnum. - */ - @JsonCreator - public static EnableStatusEnum fromString(String name) { - return fromString(name, EnableStatusEnum.class); - } - - /** @return known EnableStatusEnum values. */ - public static Collection values() { - return values(EnableStatusEnum.class); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRule.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRule.java index 4428990892804..913b28fbe34ca 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRule.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRule.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.FirewallRuleInner; @@ -31,13 +30,6 @@ public interface FirewallRule { */ String type(); - /** - * Gets the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. * @@ -52,6 +44,13 @@ public interface FirewallRule { */ String endIpAddress(); + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.FirewallRuleInner object. * @@ -81,7 +80,7 @@ interface WithParentResource { * @param serverName The name of the server. * @return the next definition stage. */ - WithStartIpAddress withExistingFlexibleServer(String resourceGroupName, String serverName); + WithStartIpAddress withExistingServer(String resourceGroupName, String serverName); } /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ interface WithStartIpAddress { diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRuleListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRuleListResult.java index 9e477f69c71a9..2cf848f09b71b 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRuleListResult.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRuleListResult.java @@ -18,12 +18,6 @@ public final class FirewallRuleListResult { @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - /** * Get the value property: The list of firewall rules in a server. * @@ -44,26 +38,6 @@ public FirewallRuleListResult withValue(List 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 FirewallRuleListResult object itself. - */ - public FirewallRuleListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRules.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRules.java index 896d11ec22afa..9521e3af6bfff 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRules.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/FirewallRules.java @@ -11,7 +11,7 @@ /** Resource collection API of FirewallRules. */ public interface FirewallRules { /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -23,7 +23,7 @@ public interface FirewallRules { void delete(String resourceGroupName, String serverName, String firewallRuleName); /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -112,7 +112,7 @@ Response getWithResponse( Response getByIdWithResponse(String id, Context context); /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -122,7 +122,7 @@ Response getWithResponse( void deleteById(String id); /** - * Deletes a firewall rule. + * Deletes a server firewall rule. * * @param id the resource ID. * @param context The context to associate with this operation. diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/GeoRedundantBackup.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/GeoRedundantBackup.java new file mode 100644 index 0000000000000..a7e2ecb15ffa8 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/GeoRedundantBackup.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GeoRedundantBackup. */ +public final class GeoRedundantBackup extends ExpandableStringEnum { + /** Static value Enabled for GeoRedundantBackup. */ + public static final GeoRedundantBackup ENABLED = fromString("Enabled"); + + /** Static value Disabled for GeoRedundantBackup. */ + public static final GeoRedundantBackup DISABLED = fromString("Disabled"); + + /** + * Creates or finds a GeoRedundantBackup from its string representation. + * + * @param name a name to look for. + * @return the corresponding GeoRedundantBackup. + */ + @JsonCreator + public static GeoRedundantBackup fromString(String name) { + return fromString(name, GeoRedundantBackup.class); + } + + /** + * Gets known GeoRedundantBackup values. + * + * @return known GeoRedundantBackup values. + */ + public static Collection values() { + return values(GeoRedundantBackup.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/GetPrivateDnsZoneSuffixResponse.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/GetPrivateDnsZoneSuffixResponse.java deleted file mode 100644 index d0826b59a6b45..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/GetPrivateDnsZoneSuffixResponse.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.mysqlflexibleserver.models; - -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.GetPrivateDnsZoneSuffixResponseInner; - -/** An immutable client-side representation of GetPrivateDnsZoneSuffixResponse. */ -public interface GetPrivateDnsZoneSuffixResponse { - /** - * Gets the privateDnsZoneSuffix property: Represents the private DNS zone suffix. - * - * @return the privateDnsZoneSuffix value. - */ - String privateDnsZoneSuffix(); - - /** - * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.GetPrivateDnsZoneSuffixResponseInner - * object. - * - * @return the inner object. - */ - GetPrivateDnsZoneSuffixResponseInner innerModel(); -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/HighAvailability.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/HighAvailability.java deleted file mode 100644 index 245fb25623f70..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/HighAvailability.java +++ /dev/null @@ -1,87 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Network related properties of a server. */ -@Fluent -public final class HighAvailability { - /* - * High availability mode for a server. - */ - @JsonProperty(value = "mode") - private HighAvailabilityMode mode; - - /* - * The state of server high availability. - */ - @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) - private HighAvailabilityState state; - - /* - * Availability zone of the standby server. - */ - @JsonProperty(value = "standbyAvailabilityZone") - private String standbyAvailabilityZone; - - /** - * Get the mode property: High availability mode for a server. - * - * @return the mode value. - */ - public HighAvailabilityMode mode() { - return this.mode; - } - - /** - * Set the mode property: High availability mode for a server. - * - * @param mode the mode value to set. - * @return the HighAvailability object itself. - */ - public HighAvailability withMode(HighAvailabilityMode mode) { - this.mode = mode; - return this; - } - - /** - * Get the state property: The state of server high availability. - * - * @return the state value. - */ - public HighAvailabilityState state() { - return this.state; - } - - /** - * Get the standbyAvailabilityZone property: Availability zone of the standby server. - * - * @return the standbyAvailabilityZone value. - */ - public String standbyAvailabilityZone() { - return this.standbyAvailabilityZone; - } - - /** - * Set the standbyAvailabilityZone property: Availability zone of the standby server. - * - * @param standbyAvailabilityZone the standbyAvailabilityZone value to set. - * @return the HighAvailability object itself. - */ - public HighAvailability withStandbyAvailabilityZone(String standbyAvailabilityZone) { - this.standbyAvailabilityZone = standbyAvailabilityZone; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/HighAvailabilityMode.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/HighAvailabilityMode.java deleted file mode 100644 index 779d8b5e3b121..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/HighAvailabilityMode.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.mysqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for HighAvailabilityMode. */ -public final class HighAvailabilityMode extends ExpandableStringEnum { - /** Static value Disabled for HighAvailabilityMode. */ - public static final HighAvailabilityMode DISABLED = fromString("Disabled"); - - /** Static value ZoneRedundant for HighAvailabilityMode. */ - public static final HighAvailabilityMode ZONE_REDUNDANT = fromString("ZoneRedundant"); - - /** Static value SameZone for HighAvailabilityMode. */ - public static final HighAvailabilityMode SAME_ZONE = fromString("SameZone"); - - /** - * Creates or finds a HighAvailabilityMode from its string representation. - * - * @param name a name to look for. - * @return the corresponding HighAvailabilityMode. - */ - @JsonCreator - public static HighAvailabilityMode fromString(String name) { - return fromString(name, HighAvailabilityMode.class); - } - - /** @return known HighAvailabilityMode values. */ - public static Collection values() { - return values(HighAvailabilityMode.class); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/HighAvailabilityState.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/HighAvailabilityState.java deleted file mode 100644 index 2fc60cbeadd96..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/HighAvailabilityState.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.mysqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for HighAvailabilityState. */ -public final class HighAvailabilityState extends ExpandableStringEnum { - /** Static value NotEnabled for HighAvailabilityState. */ - public static final HighAvailabilityState NOT_ENABLED = fromString("NotEnabled"); - - /** Static value CreatingStandby for HighAvailabilityState. */ - public static final HighAvailabilityState CREATING_STANDBY = fromString("CreatingStandby"); - - /** Static value Healthy for HighAvailabilityState. */ - public static final HighAvailabilityState HEALTHY = fromString("Healthy"); - - /** Static value FailingOver for HighAvailabilityState. */ - public static final HighAvailabilityState FAILING_OVER = fromString("FailingOver"); - - /** Static value RemovingStandby for HighAvailabilityState. */ - public static final HighAvailabilityState REMOVING_STANDBY = fromString("RemovingStandby"); - - /** - * Creates or finds a HighAvailabilityState from its string representation. - * - * @param name a name to look for. - * @return the corresponding HighAvailabilityState. - */ - @JsonCreator - public static HighAvailabilityState fromString(String name) { - return fromString(name, HighAvailabilityState.class); - } - - /** @return known HighAvailabilityState values. */ - public static Collection values() { - return values(HighAvailabilityState.class); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Identity.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Identity.java deleted file mode 100644 index f33ab7445d701..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Identity.java +++ /dev/null @@ -1,105 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Map; - -/** Properties to configure Identity for Bring your Own Keys. */ -@Fluent -public class Identity { - /* - * ObjectId from the KeyVault - */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) - private String principalId; - - /* - * TenantId from the KeyVault - */ - @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) - private String tenantId; - - /* - * Type of managed service identity. - */ - @JsonProperty(value = "type") - private ManagedServiceIdentityType type; - - /* - * Metadata of user assigned identity. - */ - @JsonProperty(value = "userAssignedIdentities") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) - private Map userAssignedIdentities; - - /** - * Get the principalId property: ObjectId from the KeyVault. - * - * @return the principalId value. - */ - public String principalId() { - return this.principalId; - } - - /** - * Get the tenantId property: TenantId from the KeyVault. - * - * @return the tenantId value. - */ - public String tenantId() { - return this.tenantId; - } - - /** - * Get the type property: Type of managed service identity. - * - * @return the type value. - */ - public ManagedServiceIdentityType type() { - return this.type; - } - - /** - * Set the type property: Type of managed service identity. - * - * @param type the type value to set. - * @return the Identity object itself. - */ - public Identity withType(ManagedServiceIdentityType type) { - this.type = type; - return this; - } - - /** - * Get the userAssignedIdentities property: Metadata of user assigned identity. - * - * @return the userAssignedIdentities value. - */ - public Map userAssignedIdentities() { - return this.userAssignedIdentities; - } - - /** - * Set the userAssignedIdentities property: Metadata of user assigned identity. - * - * @param userAssignedIdentities the userAssignedIdentities value to set. - * @return the Identity object itself. - */ - public Identity withUserAssignedIdentities(Map userAssignedIdentities) { - this.userAssignedIdentities = userAssignedIdentities; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IdentityType.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IdentityType.java new file mode 100644 index 0000000000000..628e5f41ecca6 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IdentityType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IdentityType. */ +public final class IdentityType extends ExpandableStringEnum { + /** Static value SystemAssigned for IdentityType. */ + public static final IdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Creates or finds a IdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding IdentityType. + */ + @JsonCreator + public static IdentityType fromString(String name) { + return fromString(name, IdentityType.class); + } + + /** + * Gets known IdentityType values. + * + * @return known IdentityType values. + */ + public static Collection values() { + return values(IdentityType.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/InfrastructureEncryption.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/InfrastructureEncryption.java new file mode 100644 index 0000000000000..7cd8bd3ff3cd7 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/InfrastructureEncryption.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InfrastructureEncryption. */ +public final class InfrastructureEncryption extends ExpandableStringEnum { + /** Static value Enabled for InfrastructureEncryption. */ + public static final InfrastructureEncryption ENABLED = fromString("Enabled"); + + /** Static value Disabled for InfrastructureEncryption. */ + public static final InfrastructureEncryption DISABLED = fromString("Disabled"); + + /** + * Creates or finds a InfrastructureEncryption from its string representation. + * + * @param name a name to look for. + * @return the corresponding InfrastructureEncryption. + */ + @JsonCreator + public static InfrastructureEncryption fromString(String name) { + return fromString(name, InfrastructureEncryption.class); + } + + /** + * Gets known InfrastructureEncryption values. + * + * @return known InfrastructureEncryption values. + */ + public static Collection values() { + return values(InfrastructureEncryption.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IsConfigPendingRestart.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IsConfigPendingRestart.java deleted file mode 100644 index 2d8f041ee3616..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IsConfigPendingRestart.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.mysqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for IsConfigPendingRestart. */ -public final class IsConfigPendingRestart extends ExpandableStringEnum { - /** Static value True for IsConfigPendingRestart. */ - public static final IsConfigPendingRestart TRUE = fromString("True"); - - /** Static value False for IsConfigPendingRestart. */ - public static final IsConfigPendingRestart FALSE = fromString("False"); - - /** - * Creates or finds a IsConfigPendingRestart from its string representation. - * - * @param name a name to look for. - * @return the corresponding IsConfigPendingRestart. - */ - @JsonCreator - public static IsConfigPendingRestart fromString(String name) { - return fromString(name, IsConfigPendingRestart.class); - } - - /** @return known IsConfigPendingRestart values. */ - public static Collection values() { - return values(IsConfigPendingRestart.class); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IsDynamicConfig.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IsDynamicConfig.java deleted file mode 100644 index 06d0b5df31bde..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IsDynamicConfig.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.mysqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for IsDynamicConfig. */ -public final class IsDynamicConfig extends ExpandableStringEnum { - /** Static value True for IsDynamicConfig. */ - public static final IsDynamicConfig TRUE = fromString("True"); - - /** Static value False for IsDynamicConfig. */ - public static final IsDynamicConfig FALSE = fromString("False"); - - /** - * Creates or finds a IsDynamicConfig from its string representation. - * - * @param name a name to look for. - * @return the corresponding IsDynamicConfig. - */ - @JsonCreator - public static IsDynamicConfig fromString(String name) { - return fromString(name, IsDynamicConfig.class); - } - - /** @return known IsDynamicConfig values. */ - public static Collection values() { - return values(IsDynamicConfig.class); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IsReadOnly.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IsReadOnly.java deleted file mode 100644 index edfda72b0eb09..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/IsReadOnly.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.mysqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for IsReadOnly. */ -public final class IsReadOnly extends ExpandableStringEnum { - /** Static value True for IsReadOnly. */ - public static final IsReadOnly TRUE = fromString("True"); - - /** Static value False for IsReadOnly. */ - public static final IsReadOnly FALSE = fromString("False"); - - /** - * Creates or finds a IsReadOnly from its string representation. - * - * @param name a name to look for. - * @return the corresponding IsReadOnly. - */ - @JsonCreator - public static IsReadOnly fromString(String name) { - return fromString(name, IsReadOnly.class); - } - - /** @return known IsReadOnly values. */ - public static Collection values() { - return values(IsReadOnly.class); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedCapabilities.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedPerformanceTiers.java similarity index 62% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedCapabilities.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedPerformanceTiers.java index 2d66fa1b2f116..e76c2eca0dc1b 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedCapabilities.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedPerformanceTiers.java @@ -7,30 +7,28 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -/** Resource collection API of LocationBasedCapabilities. */ -public interface LocationBasedCapabilities { +/** Resource collection API of LocationBasedPerformanceTiers. */ +public interface LocationBasedPerformanceTiers { /** - * Get capabilities at specified location in a given subscription. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. * @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 at specified location in a given subscription as paginated response with {@link - * PagedIterable}. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ - PagedIterable list(String locationName); + PagedIterable list(String locationName); /** - * Get capabilities at specified location in a given subscription. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. * @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 at specified location in a given subscription as paginated response with {@link - * PagedIterable}. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ - PagedIterable list(String locationName, Context context); + PagedIterable list(String locationName, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CheckVirtualNetworkSubnetUsages.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedRecommendedActionSessionsOperationStatus.java similarity index 56% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CheckVirtualNetworkSubnetUsages.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedRecommendedActionSessionsOperationStatus.java index bca52900d056c..5ace20b3d04c8 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CheckVirtualNetworkSubnetUsages.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedRecommendedActionSessionsOperationStatus.java @@ -7,31 +7,31 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of CheckVirtualNetworkSubnetUsages. */ -public interface CheckVirtualNetworkSubnetUsages { +/** Resource collection API of LocationBasedRecommendedActionSessionsOperationStatus. */ +public interface LocationBasedRecommendedActionSessionsOperationStatus { /** - * Get virtual network subnet usage for a given vNet resource id. + * Recommendation action session operation status. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param operationId The operation identifier. * @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 virtual network subnet usage for a given vNet resource id. + * @return recommendation action session operation status. */ - VirtualNetworkSubnetUsageResult execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); + RecommendedActionSessionsOperationStatus get(String locationName, String operationId); /** - * Get virtual network subnet usage for a given vNet resource id. + * Recommendation action session operation status. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param operationId The operation identifier. * @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 virtual network subnet usage for a given vNet resource id along with {@link Response}. + * @return recommendation action session operation status along with {@link Response}. */ - Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context); + Response getWithResponse( + String locationName, String operationId, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedRecommendedActionSessionsResults.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedRecommendedActionSessionsResults.java new file mode 100644 index 0000000000000..12648350e81ac --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LocationBasedRecommendedActionSessionsResults.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.mysqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LocationBasedRecommendedActionSessionsResults. */ +public interface LocationBasedRecommendedActionSessionsResults { + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @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 recommendation actions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String locationName, String operationId); + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @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 recommendation actions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String locationName, String operationId, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LogFile.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LogFile.java new file mode 100644 index 0000000000000..39e103fc0e7d4 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LogFile.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.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 sizeInKB property: Size of the log file. + * + * @return the sizeInKB value. + */ + Long sizeInKB(); + + /** + * 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 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.mysqlflexibleserver.fluent.models.LogFileInner object. + * + * @return the inner object. + */ + LogFileInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationListForBatchUpdate.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LogFileListResult.java similarity index 61% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationListForBatchUpdate.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LogFileListResult.java index 72697a25c61fd..b15b62c9e4d62 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ConfigurationListForBatchUpdate.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LogFileListResult.java @@ -5,34 +5,35 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.LogFileInner; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** A list of server configurations to update. */ +/** A list of log files. */ @Fluent -public final class ConfigurationListForBatchUpdate { +public final class LogFileListResult { /* - * The list of server configurations. + * The list of log files. */ @JsonProperty(value = "value") - private List value; + private List value; /** - * Get the value property: The list of server configurations. + * Get the value property: The list of log files. * * @return the value value. */ - public List value() { + public List value() { return this.value; } /** - * Set the value property: The list of server configurations. + * Set the value property: The list of log files. * * @param value the value value to set. - * @return the ConfigurationListForBatchUpdate object itself. + * @return the LogFileListResult object itself. */ - public ConfigurationListForBatchUpdate withValue(List value) { + public LogFileListResult withValue(List value) { this.value = value; return this; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LogFiles.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/LogFiles.java new file mode 100644 index 0000000000000..6992668962436 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/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.mysqlflexibleserver.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 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 log files as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the 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 log files as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/MaintenanceWindow.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/MaintenanceWindow.java deleted file mode 100644 index cdc7ae6382a9e..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/MaintenanceWindow.java +++ /dev/null @@ -1,124 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Maintenance window of a server. */ -@Fluent -public final class MaintenanceWindow { - /* - * indicates whether custom window is enabled or disabled - */ - @JsonProperty(value = "customWindow") - private String customWindow; - - /* - * start hour for maintenance window - */ - @JsonProperty(value = "startHour") - private Integer startHour; - - /* - * start minute for maintenance window - */ - @JsonProperty(value = "startMinute") - private Integer startMinute; - - /* - * day of week for maintenance window - */ - @JsonProperty(value = "dayOfWeek") - private Integer dayOfWeek; - - /** - * Get the customWindow property: indicates whether custom window is enabled or disabled. - * - * @return the customWindow value. - */ - public String customWindow() { - return this.customWindow; - } - - /** - * Set the customWindow property: indicates whether custom window is enabled or disabled. - * - * @param customWindow the customWindow value to set. - * @return the MaintenanceWindow object itself. - */ - public MaintenanceWindow withCustomWindow(String customWindow) { - this.customWindow = customWindow; - return this; - } - - /** - * Get the startHour property: start hour for maintenance window. - * - * @return the startHour value. - */ - public Integer startHour() { - return this.startHour; - } - - /** - * Set the startHour property: start hour for maintenance window. - * - * @param startHour the startHour value to set. - * @return the MaintenanceWindow object itself. - */ - public MaintenanceWindow withStartHour(Integer startHour) { - this.startHour = startHour; - return this; - } - - /** - * Get the startMinute property: start minute for maintenance window. - * - * @return the startMinute value. - */ - public Integer startMinute() { - return this.startMinute; - } - - /** - * Set the startMinute property: start minute for maintenance window. - * - * @param startMinute the startMinute value to set. - * @return the MaintenanceWindow object itself. - */ - public MaintenanceWindow withStartMinute(Integer startMinute) { - this.startMinute = startMinute; - return this; - } - - /** - * Get the dayOfWeek property: day of week for maintenance window. - * - * @return the dayOfWeek value. - */ - public Integer dayOfWeek() { - return this.dayOfWeek; - } - - /** - * Set the dayOfWeek property: day of week for maintenance window. - * - * @param dayOfWeek the dayOfWeek value to set. - * @return the MaintenanceWindow object itself. - */ - public MaintenanceWindow withDayOfWeek(Integer dayOfWeek) { - this.dayOfWeek = dayOfWeek; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/MinimalTlsVersionEnum.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/MinimalTlsVersionEnum.java new file mode 100644 index 0000000000000..32fe3c247eefa --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/MinimalTlsVersionEnum.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MinimalTlsVersionEnum. */ +public final class MinimalTlsVersionEnum extends ExpandableStringEnum { + /** Static value TLS1_0 for MinimalTlsVersionEnum. */ + public static final MinimalTlsVersionEnum TLS1_0 = fromString("TLS1_0"); + + /** Static value TLS1_1 for MinimalTlsVersionEnum. */ + public static final MinimalTlsVersionEnum TLS1_1 = fromString("TLS1_1"); + + /** Static value TLS1_2 for MinimalTlsVersionEnum. */ + public static final MinimalTlsVersionEnum TLS1_2 = fromString("TLS1_2"); + + /** Static value TLSEnforcementDisabled for MinimalTlsVersionEnum. */ + public static final MinimalTlsVersionEnum TLSENFORCEMENT_DISABLED = fromString("TLSEnforcementDisabled"); + + /** + * Creates or finds a MinimalTlsVersionEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding MinimalTlsVersionEnum. + */ + @JsonCreator + public static MinimalTlsVersionEnum fromString(String name) { + return fromString(name, MinimalTlsVersionEnum.class); + } + + /** + * Gets known MinimalTlsVersionEnum values. + * + * @return known MinimalTlsVersionEnum values. + */ + public static Collection values() { + return values(MinimalTlsVersionEnum.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Network.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Network.java deleted file mode 100644 index 45035afeb585b..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Network.java +++ /dev/null @@ -1,89 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Network related properties of a server. */ -@Fluent -public final class Network { - /* - * Whether or not public network access is allowed for this server. Value - * is 'Disabled' when server has VNet integration. - */ - @JsonProperty(value = "publicNetworkAccess", access = JsonProperty.Access.WRITE_ONLY) - private EnableStatusEnum publicNetworkAccess; - - /* - * Delegated subnet resource id used to setup vnet for a server. - */ - @JsonProperty(value = "delegatedSubnetResourceId") - private String delegatedSubnetResourceId; - - /* - * Private DNS zone resource id. - */ - @JsonProperty(value = "privateDnsZoneResourceId") - private String privateDnsZoneResourceId; - - /** - * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is - * 'Disabled' when server has VNet integration. - * - * @return the publicNetworkAccess value. - */ - public EnableStatusEnum publicNetworkAccess() { - return this.publicNetworkAccess; - } - - /** - * Get the delegatedSubnetResourceId property: Delegated subnet resource id used to setup vnet for a server. - * - * @return the delegatedSubnetResourceId value. - */ - public String delegatedSubnetResourceId() { - return this.delegatedSubnetResourceId; - } - - /** - * Set the delegatedSubnetResourceId property: Delegated subnet resource id used to setup vnet for a server. - * - * @param delegatedSubnetResourceId the delegatedSubnetResourceId value to set. - * @return the Network object itself. - */ - public Network withDelegatedSubnetResourceId(String delegatedSubnetResourceId) { - this.delegatedSubnetResourceId = delegatedSubnetResourceId; - return this; - } - - /** - * Get the privateDnsZoneResourceId property: Private DNS zone resource id. - * - * @return the privateDnsZoneResourceId value. - */ - public String privateDnsZoneResourceId() { - return this.privateDnsZoneResourceId; - } - - /** - * Set the privateDnsZoneResourceId property: Private DNS zone resource id. - * - * @param privateDnsZoneResourceId the privateDnsZoneResourceId value to set. - * @return the Network object itself. - */ - public Network withPrivateDnsZoneResourceId(String privateDnsZoneResourceId) { - this.privateDnsZoneResourceId = privateDnsZoneResourceId; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Operation.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Operation.java index 06bc0c4ec40e2..e4033efb295f7 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Operation.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Operation.java @@ -4,43 +4,84 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationInner; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; -/** An immutable client-side representation of Operation. */ -public interface Operation { +/** REST API operation definition. */ +@Immutable +public final class Operation { + /* + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The localized display information for this particular operation or + * action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /* + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + /** - * Gets the name property: The name of the operation being performed on this particular object. + * Get the name property: The name of the operation being performed on this particular object. * * @return the name value. */ - String name(); + public String name() { + return this.name; + } /** - * Gets the display property: The localized display information for this particular operation or action. + * Get the display property: The localized display information for this particular operation or action. * * @return the display value. */ - OperationDisplay display(); + public OperationDisplay display() { + return this.display; + } /** - * Gets the origin property: The intended executor of the operation. + * Get the origin property: The intended executor of the operation. * * @return the origin value. */ - String origin(); + public OperationOrigin origin() { + return this.origin; + } /** - * Gets the properties property: Additional descriptions for the operation. + * Get the properties property: Additional descriptions for the operation. * * @return the properties value. */ - Map properties(); + public Map properties() { + return this.properties; + } /** - * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationInner object. + * Validates the instance. * - * @return the inner object. + * @throws IllegalArgumentException thrown if the instance is not valid. */ - OperationInner innerModel(); + public void validate() { + if (display() != null) { + display().validate(); + } + } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationDisplay.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationDisplay.java index 22486f22dbc49..af2a60df5cee4 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationDisplay.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationDisplay.java @@ -4,34 +4,34 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; /** Display metadata associated with the operation. */ -@Fluent +@Immutable public final class OperationDisplay { /* * Operation resource provider name. */ - @JsonProperty(value = "provider") + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) private String provider; /* * Resource on which the operation is performed. */ - @JsonProperty(value = "resource") + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) private String resource; /* * Localized friendly name for the operation. */ - @JsonProperty(value = "operation") + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) private String operation; /* * Operation description. */ - @JsonProperty(value = "description") + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /** @@ -43,17 +43,6 @@ public String provider() { return this.provider; } - /** - * Set the provider property: Operation resource provider name. - * - * @param provider the provider value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withProvider(String provider) { - this.provider = provider; - return this; - } - /** * Get the resource property: Resource on which the operation is performed. * @@ -63,17 +52,6 @@ public String resource() { return this.resource; } - /** - * Set the resource property: Resource on which the operation is performed. - * - * @param resource the resource value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withResource(String resource) { - this.resource = resource; - return this; - } - /** * Get the operation property: Localized friendly name for the operation. * @@ -83,17 +61,6 @@ public String operation() { return this.operation; } - /** - * Set the operation property: Localized friendly name for the operation. - * - * @param operation the operation value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withOperation(String operation) { - this.operation = operation; - return this; - } - /** * Get the description property: Operation description. * @@ -103,17 +70,6 @@ public String description() { return this.description; } - /** - * Set the description property: Operation description. - * - * @param description the description value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withDescription(String description) { - this.description = description; - return this; - } - /** * Validates the instance. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationListResult.java index 75085c2871f17..8243d218fc489 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationListResult.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationListResult.java @@ -4,74 +4,22 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationListResultInner; import java.util.List; -/** A list of resource provider operations. */ -@Fluent -public final class OperationListResult { - /* - * Collection of available operation details - */ - @JsonProperty(value = "value") - private List value; - - /* - * URL client should use to fetch the next page (per server side paging). - */ - @JsonProperty(value = "nextLink") - private String nextLink; - +/** An immutable client-side representation of OperationListResult. */ +public interface OperationListResult { /** - * Get the value property: Collection of available operation details. + * Gets the value property: The list of resource provider operations. * * @return the value value. */ - public List value() { - return this.value; - } - - /** - * Set the value property: Collection of available operation details. - * - * @param value the value value to set. - * @return the OperationListResult object itself. - */ - public OperationListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: URL client should use to fetch the next page (per server side paging). - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: URL client should use to fetch the next page (per server side paging). - * - * @param nextLink the nextLink value to set. - * @return the OperationListResult object itself. - */ - public OperationListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } + List value(); /** - * Validates the instance. + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.OperationListResultInner object. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @return the inner object. */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } + OperationListResultInner innerModel(); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationOrigin.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationOrigin.java new file mode 100644 index 0000000000000..4f75375d962ee --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/OperationOrigin.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperationOrigin. */ +public final class OperationOrigin extends ExpandableStringEnum { + /** Static value NotSpecified for OperationOrigin. */ + public static final OperationOrigin NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value user for OperationOrigin. */ + public static final OperationOrigin USER = fromString("user"); + + /** Static value system for OperationOrigin. */ + public static final OperationOrigin SYSTEM = fromString("system"); + + /** + * Creates or finds a OperationOrigin from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationOrigin. + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** + * Gets known OperationOrigin values. + * + * @return known OperationOrigin values. + */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Operations.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Operations.java index af2d516e57cb4..3ca0b39ae23d2 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Operations.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Operations.java @@ -4,7 +4,7 @@ package com.azure.resourcemanager.mysqlflexibleserver.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 Operations. */ @@ -14,9 +14,9 @@ public interface Operations { * * @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 resource provider operations as paginated response with {@link PagedIterable}. + * @return a list of resource provider operations. */ - PagedIterable list(); + OperationListResult list(); /** * Lists all of the available REST API operations. @@ -25,7 +25,7 @@ public interface Operations { * @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 resource provider operations as paginated response with {@link PagedIterable}. + * @return a list of resource provider operations along with {@link Response}. */ - PagedIterable list(Context context); + Response listWithResponse(Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PerformanceTierListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PerformanceTierListResult.java new file mode 100644 index 0000000000000..1252894befd98 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PerformanceTierListResult.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of performance tiers. */ +@Fluent +public final class PerformanceTierListResult { + /* + * The list of performance tiers + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of performance tiers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of performance tiers. + * + * @param value the value value to set. + * @return the PerformanceTierListResult object itself. + */ + public PerformanceTierListResult withValue(List value) { + this.value = value; + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PerformanceTierProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PerformanceTierProperties.java new file mode 100644 index 0000000000000..77eae7f982214 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PerformanceTierProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import java.util.List; + +/** An immutable client-side representation of PerformanceTierProperties. */ +public interface PerformanceTierProperties { + /** + * Gets the id property: ID of the performance tier. + * + * @return the id value. + */ + String id(); + + /** + * Gets the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @return the maxBackupRetentionDays value. + */ + Integer maxBackupRetentionDays(); + + /** + * Gets the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @return the minBackupRetentionDays value. + */ + Integer minBackupRetentionDays(); + + /** + * Gets the maxStorageMB property: Max storage allowed for a server. + * + * @return the maxStorageMB value. + */ + Integer maxStorageMB(); + + /** + * Gets the minLargeStorageMB property: Max storage allowed for a server. + * + * @return the minLargeStorageMB value. + */ + Integer minLargeStorageMB(); + + /** + * Gets the maxLargeStorageMB property: Max storage allowed for a server. + * + * @return the maxLargeStorageMB value. + */ + Integer maxLargeStorageMB(); + + /** + * Gets the minStorageMB property: Max storage allowed for a server. + * + * @return the minStorageMB value. + */ + Integer minStorageMB(); + + /** + * Gets the serviceLevelObjectives property: Service level objectives associated with the performance tier. + * + * @return the serviceLevelObjectives value. + */ + List serviceLevelObjectives(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PerformanceTierPropertiesInner object. + * + * @return the inner object. + */ + PerformanceTierPropertiesInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PerformanceTierServiceLevelObjectives.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PerformanceTierServiceLevelObjectives.java new file mode 100644 index 0000000000000..cb9dda41a3b16 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PerformanceTierServiceLevelObjectives.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Service level objectives for performance tier. */ +@Fluent +public final class PerformanceTierServiceLevelObjectives { + /* + * ID for the service level objective. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Edition of the performance tier. + */ + @JsonProperty(value = "edition") + private String edition; + + /* + * vCore associated with the service level objective + */ + @JsonProperty(value = "vCore") + private Integer vCore; + + /* + * Hardware generation associated with the service level objective + */ + @JsonProperty(value = "hardwareGeneration") + private String hardwareGeneration; + + /* + * Maximum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "maxBackupRetentionDays") + private Integer maxBackupRetentionDays; + + /* + * Minimum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "minBackupRetentionDays") + private Integer minBackupRetentionDays; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxStorageMB") + private Integer maxStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "minStorageMB") + private Integer minStorageMB; + + /** + * Get the id property: ID for the service level objective. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: ID for the service level objective. + * + * @param id the id value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withId(String id) { + this.id = id; + return this; + } + + /** + * Get the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Set the edition property: Edition of the performance tier. + * + * @param edition the edition value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withEdition(String edition) { + this.edition = edition; + return this; + } + + /** + * Get the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + public Integer vCore() { + return this.vCore; + } + + /** + * Set the vCore property: vCore associated with the service level objective. + * + * @param vCore the vCore value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withVCore(Integer vCore) { + this.vCore = vCore; + return this; + } + + /** + * Get the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + public String hardwareGeneration() { + return this.hardwareGeneration; + } + + /** + * Set the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @param hardwareGeneration the hardwareGeneration value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withHardwareGeneration(String hardwareGeneration) { + this.hardwareGeneration = hardwareGeneration; + return this; + } + + /** + * Get the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @return the maxBackupRetentionDays value. + */ + public Integer maxBackupRetentionDays() { + return this.maxBackupRetentionDays; + } + + /** + * Set the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @param maxBackupRetentionDays the maxBackupRetentionDays value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMaxBackupRetentionDays(Integer maxBackupRetentionDays) { + this.maxBackupRetentionDays = maxBackupRetentionDays; + return this; + } + + /** + * Get the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @return the minBackupRetentionDays value. + */ + public Integer minBackupRetentionDays() { + return this.minBackupRetentionDays; + } + + /** + * Set the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @param minBackupRetentionDays the minBackupRetentionDays value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMinBackupRetentionDays(Integer minBackupRetentionDays) { + this.minBackupRetentionDays = minBackupRetentionDays; + return this; + } + + /** + * Get the maxStorageMB property: Max storage allowed for a server. + * + * @return the maxStorageMB value. + */ + public Integer maxStorageMB() { + return this.maxStorageMB; + } + + /** + * Set the maxStorageMB property: Max storage allowed for a server. + * + * @param maxStorageMB the maxStorageMB value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMaxStorageMB(Integer maxStorageMB) { + this.maxStorageMB = maxStorageMB; + return this; + } + + /** + * Get the minStorageMB property: Max storage allowed for a server. + * + * @return the minStorageMB value. + */ + public Integer minStorageMB() { + return this.minStorageMB; + } + + /** + * Set the minStorageMB property: Max storage allowed for a server. + * + * @param minStorageMB the minStorageMB value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMinStorageMB(Integer minStorageMB) { + this.minStorageMB = minStorageMB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointConnection.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..6cef02e4376ca --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointConnection.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import java.util.Map; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * 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 privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the PrivateEndpointConnection 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.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointConnectionListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..72e48eb932318 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointConnectionListResult.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Immutable +public final class PrivateEndpointConnectionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointConnections.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..b5b44e5568324 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointConnections.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection. + */ + PrivateEndpointConnection get(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 private endpoint connection along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @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 private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointProperty.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointProperty.java new file mode 100644 index 0000000000000..8ded31d281efd --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointProperty.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PrivateEndpointProperty model. */ +@Fluent +public final class PrivateEndpointProperty { + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Resource id of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id of the private endpoint. + * + * @param id the id value to set. + * @return the PrivateEndpointProperty object itself. + */ + public PrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointProvisioningState.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointProvisioningState.java new file mode 100644 index 0000000000000..bef813f062328 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateEndpointProvisioningState.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.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointProvisioningState. */ +public final class PrivateEndpointProvisioningState extends ExpandableStringEnum { + /** Static value Approving for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState APPROVING = fromString("Approving"); + + /** Static value Ready for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState READY = fromString("Ready"); + + /** Static value Dropping for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState DROPPING = fromString("Dropping"); + + /** Static value Failed for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState FAILED = fromString("Failed"); + + /** Static value Rejecting for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState REJECTING = fromString("Rejecting"); + + /** + * Creates or finds a PrivateEndpointProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointProvisioningState. + */ + @JsonCreator + public static PrivateEndpointProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointProvisioningState.class); + } + + /** + * Gets known PrivateEndpointProvisioningState values. + * + * @return known PrivateEndpointProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointProvisioningState.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResource.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..9d719860e406d --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResource.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateLinkResourceInner; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The private link resource group id. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResourceListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..42050dab84912 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResourceListResult.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Immutable +public final class PrivateLinkResourceListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResourceProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..4bf5920093991 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResourceProperties.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResources.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..fe920ffaddcde --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkResources.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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 PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources for MySQL 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 private link resources for MySQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for MySQL 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 private link resources for MySQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private link resource for MySQL server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for MySQL server. + */ + PrivateLinkResource get(String resourceGroupName, String serverName, String groupName); + + /** + * Gets a private link resource for MySQL server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for MySQL server along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkServiceConnectionStateActionsRequire.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkServiceConnectionStateActionsRequire.java new file mode 100644 index 0000000000000..5237620b1a89e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkServiceConnectionStateActionsRequire.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.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStateActionsRequire. */ +public final class PrivateLinkServiceConnectionStateActionsRequire + extends ExpandableStringEnum { + /** Static value None for PrivateLinkServiceConnectionStateActionsRequire. */ + public static final PrivateLinkServiceConnectionStateActionsRequire NONE = fromString("None"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateActionsRequire from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateActionsRequire. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateActionsRequire fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateActionsRequire.class); + } + + /** + * Gets known PrivateLinkServiceConnectionStateActionsRequire values. + * + * @return known PrivateLinkServiceConnectionStateActionsRequire values. + */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateActionsRequire.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..c1da07b75cf15 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkServiceConnectionStateProperty.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private String status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The actions required for private link service connection. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: The actions required for private link service connection. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * 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 PrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model PrivateLinkServiceConnectionStateProperty")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkServiceConnectionStateStatus.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkServiceConnectionStateStatus.java new file mode 100644 index 0000000000000..da3c555c49af0 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PrivateLinkServiceConnectionStateStatus.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStateStatus. */ +public final class PrivateLinkServiceConnectionStateStatus + extends ExpandableStringEnum { + /** Static value Approved for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus APPROVED = fromString("Approved"); + + /** Static value Pending for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus PENDING = fromString("Pending"); + + /** Static value Rejected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus REJECTED = fromString("Rejected"); + + /** Static value Disconnected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateStatus. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateStatus fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateStatus.class); + } + + /** + * Gets known PrivateLinkServiceConnectionStateStatus values. + * + * @return known PrivateLinkServiceConnectionStateStatus values. + */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateStatus.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PublicNetworkAccessEnum.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PublicNetworkAccessEnum.java new file mode 100644 index 0000000000000..be86984077545 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/PublicNetworkAccessEnum.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccessEnum. */ +public final class PublicNetworkAccessEnum extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccessEnum. */ + public static final PublicNetworkAccessEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccessEnum. */ + public static final PublicNetworkAccessEnum DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccessEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccessEnum. + */ + @JsonCreator + public static PublicNetworkAccessEnum fromString(String name) { + return fromString(name, PublicNetworkAccessEnum.class); + } + + /** + * Gets known PublicNetworkAccessEnum values. + * + * @return known PublicNetworkAccessEnum values. + */ + public static Collection values() { + return values(PublicNetworkAccessEnum.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryPerformanceInsightResetDataResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryPerformanceInsightResetDataResult.java new file mode 100644 index 0000000000000..6ae063b985987 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryPerformanceInsightResetDataResult.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.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryPerformanceInsightResetDataResultInner; + +/** An immutable client-side representation of QueryPerformanceInsightResetDataResult. */ +public interface QueryPerformanceInsightResetDataResult { + /** + * Gets the status property: Indicates result of the operation. + * + * @return the status value. + */ + QueryPerformanceInsightResetDataResultState status(); + + /** + * Gets the message property: operation message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner + * com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryPerformanceInsightResetDataResultInner object. + * + * @return the inner object. + */ + QueryPerformanceInsightResetDataResultInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryPerformanceInsightResetDataResultState.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryPerformanceInsightResetDataResultState.java new file mode 100644 index 0000000000000..e1c8017cd1fc0 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryPerformanceInsightResetDataResultState.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.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for QueryPerformanceInsightResetDataResultState. */ +public final class QueryPerformanceInsightResetDataResultState + extends ExpandableStringEnum { + /** Static value Succeeded for QueryPerformanceInsightResetDataResultState. */ + public static final QueryPerformanceInsightResetDataResultState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for QueryPerformanceInsightResetDataResultState. */ + public static final QueryPerformanceInsightResetDataResultState FAILED = fromString("Failed"); + + /** + * Creates or finds a QueryPerformanceInsightResetDataResultState from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryPerformanceInsightResetDataResultState. + */ + @JsonCreator + public static QueryPerformanceInsightResetDataResultState fromString(String name) { + return fromString(name, QueryPerformanceInsightResetDataResultState.class); + } + + /** + * Gets known QueryPerformanceInsightResetDataResultState values. + * + * @return known QueryPerformanceInsightResetDataResultState values. + */ + public static Collection values() { + return values(QueryPerformanceInsightResetDataResultState.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryStatistic.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryStatistic.java new file mode 100644 index 0000000000000..eb781916989b9 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryStatistic.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryStatisticInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of QueryStatistic. */ +public interface QueryStatistic { + /** + * 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 queryId property: Database query identifier. + * + * @return the queryId value. + */ + String queryId(); + + /** + * Gets the startTime property: Observation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: Observation end time. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the aggregationFunction property: Aggregation function name. + * + * @return the aggregationFunction value. + */ + String aggregationFunction(); + + /** + * Gets the databaseNames property: The list of database names. + * + * @return the databaseNames value. + */ + List databaseNames(); + + /** + * Gets the queryExecutionCount property: Number of query executions in this time interval. + * + * @return the queryExecutionCount value. + */ + Long queryExecutionCount(); + + /** + * Gets the metricName property: Metric name. + * + * @return the metricName value. + */ + String metricName(); + + /** + * Gets the metricDisplayName property: Metric display name. + * + * @return the metricDisplayName value. + */ + String metricDisplayName(); + + /** + * Gets the metricValue property: Metric value. + * + * @return the metricValue value. + */ + Double metricValue(); + + /** + * Gets the metricValueUnit property: Metric value unit. + * + * @return the metricValueUnit value. + */ + String metricValueUnit(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryStatisticInner object. + * + * @return the inner object. + */ + QueryStatisticInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryText.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryText.java new file mode 100644 index 0000000000000..2a4c798015823 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryText.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryTextInner; + +/** An immutable client-side representation of QueryText. */ +public interface QueryText { + /** + * 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 queryId property: Query identifier unique to the server. + * + * @return the queryId value. + */ + String queryId(); + + /** + * Gets the queryText property: Query text. + * + * @return the queryText value. + */ + String queryText(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryTextInner object. + * + * @return the inner object. + */ + QueryTextInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryTexts.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryTexts.java new file mode 100644 index 0000000000000..a275b2d54bd30 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryTexts.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.mysqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of QueryTexts. */ +public interface QueryTexts { + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @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 Query Text. + */ + QueryText get(String resourceGroupName, String serverName, String queryId); + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @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 Query Text along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String serverName, String queryId, Context context); + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @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 query texts as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, List queryIds); + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @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 query texts as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryTextsResultList.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryTextsResultList.java new file mode 100644 index 0000000000000..c85320849834c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/QueryTextsResultList.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryTextInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of query texts. */ +@Immutable +public final class QueryTextsResultList { + /* + * The list of query texts. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of query texts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendationAction.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendationAction.java new file mode 100644 index 0000000000000..720849c74a45e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendationAction.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of RecommendationAction. */ +public interface RecommendationAction { + /** + * 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 advisorName property: Advisor name. + * + * @return the advisorName value. + */ + String advisorName(); + + /** + * Gets the sessionId property: Recommendation action session identifier. + * + * @return the sessionId value. + */ + String sessionId(); + + /** + * Gets the actionId property: Recommendation action identifier. + * + * @return the actionId value. + */ + Integer actionId(); + + /** + * Gets the createdTime property: Recommendation action creation time. + * + * @return the createdTime value. + */ + OffsetDateTime createdTime(); + + /** + * Gets the expirationTime property: Recommendation action expiration time. + * + * @return the expirationTime value. + */ + OffsetDateTime expirationTime(); + + /** + * Gets the reason property: Recommendation action reason. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the recommendationType property: Recommendation action type. + * + * @return the recommendationType value. + */ + String recommendationType(); + + /** + * Gets the details property: Recommendation action details. + * + * @return the details value. + */ + Map details(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner object. + * + * @return the inner object. + */ + RecommendationActionInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendationActionsResultList.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendationActionsResultList.java new file mode 100644 index 0000000000000..fbcb02d452037 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendationActionsResultList.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendationActionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of recommendation actions. */ +@Immutable +public final class RecommendationActionsResultList { + /* + * The list of recommendation action advisors. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of recommendation action advisors. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendedActionSessionsOperationStatus.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendedActionSessionsOperationStatus.java new file mode 100644 index 0000000000000..6aba60b830ad3 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendedActionSessionsOperationStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendedActionSessionsOperationStatusInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RecommendedActionSessionsOperationStatus. */ +public interface RecommendedActionSessionsOperationStatus { + /** + * Gets the name property: Operation identifier. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startTime property: Operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the status property: Operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the inner + * com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecommendedActionSessionsOperationStatusInner object. + * + * @return the inner object. + */ + RecommendedActionSessionsOperationStatusInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendedActions.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendedActions.java new file mode 100644 index 0000000000000..321b2cbc45df8 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecommendedActions.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.mysqlflexibleserver.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 RecommendedActions. */ +public interface RecommendedActions { + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action name. + * @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 Recommendation Action. + */ + RecommendationAction get( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action name. + * @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 Recommendation Action along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName, Context context); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @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 recommendation actions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, String advisorName); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @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 recommendation actions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecoverableServerResource.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecoverableServerResource.java new file mode 100644 index 0000000000000..f04631066e31e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecoverableServerResource.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecoverableServerResourceInner; + +/** An immutable client-side representation of RecoverableServerResource. */ +public interface RecoverableServerResource { + /** + * 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 lastAvailableBackupDateTime property: The last available backup date time. + * + * @return the lastAvailableBackupDateTime value. + */ + String lastAvailableBackupDateTime(); + + /** + * Gets the serviceLevelObjective property: The service level objective. + * + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * Gets the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + String edition(); + + /** + * Gets the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + Integer vCore(); + + /** + * Gets the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + String hardwareGeneration(); + + /** + * Gets the version property: The MySQL version. + * + * @return the version value. + */ + String version(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.RecoverableServerResourceInner object. + * + * @return the inner object. + */ + RecoverableServerResourceInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecoverableServers.java similarity index 52% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecoverableServers.java index 84b7fb4b0ef65..c13c1407a2353 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/RecoverableServers.java @@ -7,25 +7,30 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of GetPrivateDnsZoneSuffixes. */ -public interface GetPrivateDnsZoneSuffixes { +/** Resource collection API of RecoverableServers. */ +public interface RecoverableServers { /** - * Get private DNS zone suffix in the cloud. + * Gets a recoverable MySQL 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 private DNS zone suffix in the cloud. + * @return a recoverable MySQL Server. */ - GetPrivateDnsZoneSuffixResponse execute(); + RecoverableServerResource get(String resourceGroupName, String serverName); /** - * Get private DNS zone suffix in the cloud. + * Gets a recoverable MySQL 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 private DNS zone suffix in the cloud along with {@link Response}. + * @return a recoverable MySQL Server along with {@link Response}. */ - Response executeWithResponse(Context context); + Response getWithResponse(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ReplicationRole.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ReplicationRole.java deleted file mode 100644 index ff281043d3643..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ReplicationRole.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.mysqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ReplicationRole. */ -public final class ReplicationRole extends ExpandableStringEnum { - /** Static value None for ReplicationRole. */ - public static final ReplicationRole NONE = fromString("None"); - - /** Static value Source for ReplicationRole. */ - public static final ReplicationRole SOURCE = fromString("Source"); - - /** Static value Replica for ReplicationRole. */ - public static final ReplicationRole REPLICA = fromString("Replica"); - - /** - * Creates or finds a ReplicationRole from its string representation. - * - * @param name a name to look for. - * @return the corresponding ReplicationRole. - */ - @JsonCreator - public static ReplicationRole fromString(String name) { - return fromString(name, ReplicationRole.class); - } - - /** @return known ReplicationRole values. */ - public static Collection values() { - return values(ReplicationRole.class); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ResourceIdentity.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ResourceIdentity.java new file mode 100644 index 0000000000000..68249fee044e5 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ResourceIdentity.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Fluent +public class ResourceIdentity { + /* + * The Azure Active Directory principal id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The identity type. Set this to 'SystemAssigned' in order to + * automatically create and assign an Azure Active Directory principal for + * the resource. + */ + @JsonProperty(value = "type") + private IdentityType type; + + /* + * The Azure Active Directory tenant id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /** + * Get the principalId property: The Azure Active Directory principal id. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the type property: The identity type. Set this to 'SystemAssigned' in order to automatically create and + * assign an Azure Active Directory principal for the resource. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. Set this to 'SystemAssigned' in order to automatically create and + * assign an Azure Active Directory principal for the resource. + * + * @param type the type value to set. + * @return the ResourceIdentity object itself. + */ + public ResourceIdentity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Get the tenantId property: The Azure Active Directory tenant id. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ResourceProviders.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ResourceProviders.java new file mode 100644 index 0000000000000..c8730988bcae3 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ResourceProviders.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Reset data for Query Performance Insight. + * + * @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 result of Query Performance Insight data reset. + */ + QueryPerformanceInsightResetDataResult resetQueryPerformanceInsightData( + String resourceGroupName, String serverName); + + /** + * Reset data for Query Performance Insight. + * + * @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 result of Query Performance Insight data reset along with {@link Response}. + */ + Response resetQueryPerformanceInsightDataWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @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 createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SecurityAlertPolicyName.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SecurityAlertPolicyName.java new file mode 100644 index 0000000000000..a48fdbb563ead --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SecurityAlertPolicyName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecurityAlertPolicyName. */ +public final class SecurityAlertPolicyName extends ExpandableStringEnum { + /** Static value Default for SecurityAlertPolicyName. */ + public static final SecurityAlertPolicyName DEFAULT = fromString("Default"); + + /** + * Creates or finds a SecurityAlertPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityAlertPolicyName. + */ + @JsonCreator + public static SecurityAlertPolicyName fromString(String name) { + return fromString(name, SecurityAlertPolicyName.class); + } + + /** + * Gets known SecurityAlertPolicyName values. + * + * @return known SecurityAlertPolicyName values. + */ + public static Collection values() { + return values(SecurityAlertPolicyName.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Server.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Server.java index 4eca39fd0caf4..34b81341b968e 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Server.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Server.java @@ -5,10 +5,10 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; import com.azure.core.management.Region; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerInner; import java.time.OffsetDateTime; +import java.util.List; import java.util.Map; /** An immutable client-side representation of Server. */ @@ -49,11 +49,11 @@ public interface Server { Map tags(); /** - * Gets the identity property: The cmk identity for the server. + * Gets the identity property: The Azure Active Directory identity of the server. * * @return the identity value. */ - Identity identity(); + ResourceIdentity identity(); /** * Gets the sku property: The SKU (pricing tier) of the server. @@ -62,13 +62,6 @@ public interface Server { */ Sku sku(); - /** - * Gets the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the administratorLogin property: The administrator's login name of a server. Can only be specified when the * server is being created (and is required for creation). @@ -77,14 +70,6 @@ public interface Server { */ String administratorLogin(); - /** - * Gets the administratorLoginPassword property: The password of the administrator login (required for server - * creation). - * - * @return the administratorLoginPassword value. - */ - String administratorLoginPassword(); - /** * Gets the version property: Server version. * @@ -93,103 +78,97 @@ public interface Server { ServerVersion version(); /** - * Gets the availabilityZone property: availability Zone information of the server. + * Gets the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @return the availabilityZone value. + * @return the sslEnforcement value. */ - String availabilityZone(); + SslEnforcementEnum sslEnforcement(); /** - * Gets the createMode property: The mode to create a new MySQL server. + * Gets the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the createMode value. + * @return the minimalTlsVersion value. */ - CreateMode createMode(); + MinimalTlsVersionEnum minimalTlsVersion(); /** - * Gets the sourceServerResourceId property: The source MySQL server id. + * Gets the byokEnforcement property: Status showing whether the server data encryption is enabled with + * customer-managed keys. * - * @return the sourceServerResourceId value. + * @return the byokEnforcement value. */ - String sourceServerResourceId(); + String byokEnforcement(); /** - * Gets the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to - * restore from. + * Gets the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @return the restorePointInTime value. + * @return the infrastructureEncryption value. */ - OffsetDateTime restorePointInTime(); + InfrastructureEncryption infrastructureEncryption(); /** - * Gets the replicationRole property: The replication role. + * Gets the userVisibleState property: A state of a server that is visible to user. * - * @return the replicationRole value. - */ - ReplicationRole replicationRole(); - - /** - * Gets the replicaCapacity property: The maximum number of replicas that a primary server can have. - * - * @return the replicaCapacity value. + * @return the userVisibleState value. */ - Integer replicaCapacity(); + ServerState userVisibleState(); /** - * Gets the dataEncryption property: The Data Encryption for CMK. + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @return the dataEncryption value. + * @return the fullyQualifiedDomainName value. */ - DataEncryption dataEncryption(); + String fullyQualifiedDomainName(); /** - * Gets the state property: The state of a server. + * Gets the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the state value. + * @return the earliestRestoreDate value. */ - ServerState state(); + OffsetDateTime earliestRestoreDate(); /** - * Gets the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * Gets the storageProfile property: Storage profile of a server. * - * @return the fullyQualifiedDomainName value. + * @return the storageProfile value. */ - String fullyQualifiedDomainName(); + StorageProfile storageProfile(); /** - * Gets the storage property: Storage related properties of a server. + * Gets the replicationRole property: The replication role of the server. * - * @return the storage value. + * @return the replicationRole value. */ - Storage storage(); + String replicationRole(); /** - * Gets the backup property: Backup related properties of a server. + * Gets the masterServerId property: The master server id of a replica server. * - * @return the backup value. + * @return the masterServerId value. */ - Backup backup(); + String masterServerId(); /** - * Gets the highAvailability property: High availability related properties of a server. + * Gets the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @return the highAvailability value. + * @return the replicaCapacity value. */ - HighAvailability highAvailability(); + Integer replicaCapacity(); /** - * Gets the network property: Network related properties of a server. + * Gets the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. * - * @return the network value. + * @return the publicNetworkAccess value. */ - Network network(); + PublicNetworkAccessEnum publicNetworkAccess(); /** - * Gets the maintenanceWindow property: Maintenance window of a server. + * Gets the privateEndpointConnections property: List of private endpoint connections on a server. * - * @return the maintenanceWindow value. + * @return the privateEndpointConnections value. */ - MaintenanceWindow maintenanceWindow(); + List privateEndpointConnections(); /** * Gets the region of the resource. @@ -205,6 +184,13 @@ public interface Server { */ String regionName(); + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerInner object. * @@ -217,6 +203,7 @@ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, DefinitionStages.WithCreate { } /** The Server definition stages. */ @@ -229,7 +216,7 @@ interface WithLocation { /** * Specifies the region for the resource. * - * @param location The geo-location where the resource lives. + * @param location The location the resource resides in. * @return the next definition stage. */ WithResourceGroup withRegion(Region location); @@ -237,7 +224,7 @@ interface WithLocation { /** * Specifies the region for the resource. * - * @param location The geo-location where the resource lives. + * @param location The location the resource resides in. * @return the next definition stage. */ WithResourceGroup withRegion(String location); @@ -250,29 +237,24 @@ interface WithResourceGroup { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. */ - WithCreate withExistingResourceGroup(String resourceGroupName); + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the Server definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the server.. + * + * @param properties Properties of the server. + * @return the next definition stage. + */ + WithCreate withProperties(ServerPropertiesForCreate properties); } /** * The stage of the Server 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.WithIdentity, - DefinitionStages.WithSku, - DefinitionStages.WithAdministratorLogin, - DefinitionStages.WithAdministratorLoginPassword, - DefinitionStages.WithVersion, - DefinitionStages.WithAvailabilityZone, - DefinitionStages.WithCreateMode, - DefinitionStages.WithSourceServerResourceId, - DefinitionStages.WithRestorePointInTime, - DefinitionStages.WithReplicationRole, - DefinitionStages.WithDataEncryption, - DefinitionStages.WithStorage, - DefinitionStages.WithBackup, - DefinitionStages.WithHighAvailability, - DefinitionStages.WithNetwork { + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithSku { /** * Executes the create request. * @@ -291,9 +273,9 @@ interface WithCreate /** The stage of the Server definition allowing to specify tags. */ interface WithTags { /** - * Specifies the tags property: Resource tags.. + * Specifies the tags property: Application-specific metadata in the form of key-value pairs.. * - * @param tags Resource tags. + * @param tags Application-specific metadata in the form of key-value pairs. * @return the next definition stage. */ WithCreate withTags(Map tags); @@ -301,12 +283,12 @@ interface WithTags { /** The stage of the Server definition allowing to specify identity. */ interface WithIdentity { /** - * Specifies the identity property: The cmk identity for the server.. + * Specifies the identity property: The Azure Active Directory identity of the server.. * - * @param identity The cmk identity for the server. + * @param identity The Azure Active Directory identity of the server. * @return the next definition stage. */ - WithCreate withIdentity(Identity identity); + WithCreate withIdentity(ResourceIdentity identity); } /** The stage of the Server definition allowing to specify sku. */ interface WithSku { @@ -318,141 +300,6 @@ interface WithSku { */ WithCreate withSku(Sku sku); } - /** The stage of the Server definition allowing to specify administratorLogin. */ - interface WithAdministratorLogin { - /** - * Specifies the administratorLogin property: The administrator's login name of a server. Can only be - * specified when the server is being created (and is required for creation).. - * - * @param administratorLogin The administrator's login name of a server. Can only be specified when the - * server is being created (and is required for creation). - * @return the next definition stage. - */ - WithCreate withAdministratorLogin(String administratorLogin); - } - /** The stage of the Server definition allowing to specify administratorLoginPassword. */ - interface WithAdministratorLoginPassword { - /** - * Specifies the administratorLoginPassword property: The password of the administrator login (required for - * server creation).. - * - * @param administratorLoginPassword The password of the administrator login (required for server creation). - * @return the next definition stage. - */ - WithCreate withAdministratorLoginPassword(String administratorLoginPassword); - } - /** The stage of the Server definition allowing to specify version. */ - interface WithVersion { - /** - * Specifies the version property: Server version.. - * - * @param version Server version. - * @return the next definition stage. - */ - WithCreate withVersion(ServerVersion version); - } - /** The stage of the Server definition allowing to specify availabilityZone. */ - interface WithAvailabilityZone { - /** - * Specifies the availabilityZone property: availability Zone information of the server.. - * - * @param availabilityZone availability Zone information of the server. - * @return the next definition stage. - */ - WithCreate withAvailabilityZone(String availabilityZone); - } - /** The stage of the Server definition allowing to specify createMode. */ - interface WithCreateMode { - /** - * Specifies the createMode property: The mode to create a new MySQL server.. - * - * @param createMode The mode to create a new MySQL server. - * @return the next definition stage. - */ - WithCreate withCreateMode(CreateMode createMode); - } - /** The stage of the Server definition allowing to specify sourceServerResourceId. */ - interface WithSourceServerResourceId { - /** - * Specifies the sourceServerResourceId property: The source MySQL server id.. - * - * @param sourceServerResourceId The source MySQL server id. - * @return the next definition stage. - */ - WithCreate withSourceServerResourceId(String sourceServerResourceId); - } - /** The stage of the Server definition allowing to specify restorePointInTime. */ - interface WithRestorePointInTime { - /** - * Specifies the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the - * time to restore from.. - * - * @param restorePointInTime Restore point creation time (ISO8601 format), specifying the time to restore - * from. - * @return the next definition stage. - */ - WithCreate withRestorePointInTime(OffsetDateTime restorePointInTime); - } - /** The stage of the Server definition allowing to specify replicationRole. */ - interface WithReplicationRole { - /** - * Specifies the replicationRole property: The replication role.. - * - * @param replicationRole The replication role. - * @return the next definition stage. - */ - WithCreate withReplicationRole(ReplicationRole replicationRole); - } - /** The stage of the Server definition allowing to specify dataEncryption. */ - interface WithDataEncryption { - /** - * Specifies the dataEncryption property: The Data Encryption for CMK.. - * - * @param dataEncryption The Data Encryption for CMK. - * @return the next definition stage. - */ - WithCreate withDataEncryption(DataEncryption dataEncryption); - } - /** The stage of the Server definition allowing to specify storage. */ - interface WithStorage { - /** - * Specifies the storage property: Storage related properties of a server.. - * - * @param storage Storage related properties of a server. - * @return the next definition stage. - */ - WithCreate withStorage(Storage storage); - } - /** The stage of the Server definition allowing to specify backup. */ - interface WithBackup { - /** - * Specifies the backup property: Backup related properties of a server.. - * - * @param backup Backup related properties of a server. - * @return the next definition stage. - */ - WithCreate withBackup(Backup backup); - } - /** The stage of the Server definition allowing to specify highAvailability. */ - interface WithHighAvailability { - /** - * Specifies the highAvailability property: High availability related properties of a server.. - * - * @param highAvailability High availability related properties of a server. - * @return the next definition stage. - */ - WithCreate withHighAvailability(HighAvailability highAvailability); - } - /** The stage of the Server definition allowing to specify network. */ - interface WithNetwork { - /** - * Specifies the network property: Network related properties of a server.. - * - * @param network Network related properties of a server. - * @return the next definition stage. - */ - WithCreate withNetwork(Network network); - } } /** * Begins update for the Server resource. @@ -466,13 +313,13 @@ interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithSku, + UpdateStages.WithStorageProfile, UpdateStages.WithAdministratorLoginPassword, - UpdateStages.WithStorage, - UpdateStages.WithBackup, - UpdateStages.WithHighAvailability, - UpdateStages.WithMaintenanceWindow, - UpdateStages.WithReplicationRole, - UpdateStages.WithDataEncryption { + UpdateStages.WithVersion, + UpdateStages.WithSslEnforcement, + UpdateStages.WithMinimalTlsVersion, + UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithReplicationRole { /** * Executes the update request. * @@ -503,12 +350,12 @@ interface WithTags { /** The stage of the Server update allowing to specify identity. */ interface WithIdentity { /** - * Specifies the identity property: The cmk identity for the server.. + * Specifies the identity property: The Azure Active Directory identity of the server.. * - * @param identity The cmk identity for the server. + * @param identity The Azure Active Directory identity of the server. * @return the next definition stage. */ - Update withIdentity(Identity identity); + Update withIdentity(ResourceIdentity identity); } /** The stage of the Server update allowing to specify sku. */ interface WithSku { @@ -520,6 +367,16 @@ interface WithSku { */ Update withSku(Sku sku); } + /** The stage of the Server update allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: Storage profile of a server.. + * + * @param storageProfile Storage profile of a server. + * @return the next definition stage. + */ + Update withStorageProfile(StorageProfile storageProfile); + } /** The stage of the Server update allowing to specify administratorLoginPassword. */ interface WithAdministratorLoginPassword { /** @@ -530,45 +387,47 @@ interface WithAdministratorLoginPassword { */ Update withAdministratorLoginPassword(String administratorLoginPassword); } - /** The stage of the Server update allowing to specify storage. */ - interface WithStorage { + /** The stage of the Server update allowing to specify version. */ + interface WithVersion { /** - * Specifies the storage property: Storage related properties of a server.. + * Specifies the version property: The version of a server.. * - * @param storage Storage related properties of a server. + * @param version The version of a server. * @return the next definition stage. */ - Update withStorage(Storage storage); + Update withVersion(ServerVersion version); } - /** The stage of the Server update allowing to specify backup. */ - interface WithBackup { + /** The stage of the Server update allowing to specify sslEnforcement. */ + interface WithSslEnforcement { /** - * Specifies the backup property: Backup related properties of a server.. + * Specifies the sslEnforcement property: Enable ssl enforcement or not when connect to server.. * - * @param backup Backup related properties of a server. + * @param sslEnforcement Enable ssl enforcement or not when connect to server. * @return the next definition stage. */ - Update withBackup(Backup backup); + Update withSslEnforcement(SslEnforcementEnum sslEnforcement); } - /** The stage of the Server update allowing to specify highAvailability. */ - interface WithHighAvailability { + /** The stage of the Server update allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { /** - * Specifies the highAvailability property: High availability related properties of a server.. + * Specifies the minimalTlsVersion property: Enforce a minimal Tls version for the server.. * - * @param highAvailability High availability related properties of a server. + * @param minimalTlsVersion Enforce a minimal Tls version for the server. * @return the next definition stage. */ - Update withHighAvailability(HighAvailability highAvailability); + Update withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion); } - /** The stage of the Server update allowing to specify maintenanceWindow. */ - interface WithMaintenanceWindow { + /** The stage of the Server update allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { /** - * Specifies the maintenanceWindow property: Maintenance window of a server.. + * Specifies the publicNetworkAccess property: Whether or not public network access is allowed for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. * - * @param maintenanceWindow Maintenance window of a server. + * @param publicNetworkAccess Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. * @return the next definition stage. */ - Update withMaintenanceWindow(MaintenanceWindow maintenanceWindow); + Update withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess); } /** The stage of the Server update allowing to specify replicationRole. */ interface WithReplicationRole { @@ -578,17 +437,7 @@ interface WithReplicationRole { * @param replicationRole The replication role of the server. * @return the next definition stage. */ - Update withReplicationRole(ReplicationRole replicationRole); - } - /** The stage of the Server update allowing to specify dataEncryption. */ - interface WithDataEncryption { - /** - * Specifies the dataEncryption property: The Data Encryption for CMK.. - * - * @param dataEncryption The Data Encryption for CMK. - * @return the next definition stage. - */ - Update withDataEncryption(DataEncryption dataEncryption); + Update withReplicationRole(String replicationRole); } } /** @@ -607,77 +456,77 @@ interface WithDataEncryption { Server refresh(Context context); /** - * Manual failover a server. + * Restarts a server. * * @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 failover(); + void restart(); /** - * Manual failover a server. + * Restarts a 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. */ - void failover(Context context); + void restart(Context context); /** - * Restarts a server. + * Starts a stopped server. * - * @param parameters The required parameters for restarting a 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. */ - void restart(ServerRestartParameter parameters); + void start(); /** - * Restarts a server. + * Starts a stopped server. * - * @param parameters The required parameters for restarting a 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. */ - void restart(ServerRestartParameter parameters, Context context); + void start(Context context); /** - * Starts a server. + * Stops a running server. * * @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 start(); + void stop(); /** - * Starts a server. + * Stops a running 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. */ - void start(Context context); + void stop(Context context); /** - * Stops a server. + * Upgrade server version. * + * @param parameters The required parameters for updating a 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. */ - void stop(); + void upgrade(ServerUpgradeParameters parameters); /** - * Stops a server. + * Upgrade server version. * + * @param parameters The required parameters for updating a 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. */ - void stop(Context context); + void upgrade(ServerUpgradeParameters parameters, Context context); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerBackup.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerAdministratorResource.java similarity index 51% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerBackup.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerAdministratorResource.java index 60f3877a34470..22437ef5e21b6 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerBackup.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerAdministratorResource.java @@ -4,12 +4,11 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; -import com.azure.core.management.SystemData; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerBackupInner; -import java.time.OffsetDateTime; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import java.util.UUID; -/** An immutable client-side representation of ServerBackup. */ -public interface ServerBackup { +/** An immutable client-side representation of ServerAdministratorResource. */ +public interface ServerAdministratorResource { /** * Gets the id property: Fully qualified resource Id for the resource. * @@ -32,37 +31,38 @@ public interface ServerBackup { String type(); /** - * Gets the systemData property: The system metadata relating to this resource. + * Gets the administratorType property: The type of administrator. * - * @return the systemData value. + * @return the administratorType value. */ - SystemData systemData(); + AdministratorType administratorType(); /** - * Gets the backupType property: Backup type. + * Gets the login property: The server administrator login account name. * - * @return the backupType value. + * @return the login value. */ - String backupType(); + String login(); /** - * Gets the completedTime property: Backup completed time (ISO8601 format). + * Gets the sid property: The server administrator Sid (Secure ID). * - * @return the completedTime value. + * @return the sid value. */ - OffsetDateTime completedTime(); + UUID sid(); /** - * Gets the source property: Backup source. + * Gets the tenantId property: The server Active Directory Administrator tenant id. * - * @return the source value. + * @return the tenantId value. */ - String source(); + UUID tenantId(); /** - * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerBackupInner object. + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner + * object. * * @return the inner object. */ - ServerBackupInner innerModel(); + ServerAdministratorResourceInner innerModel(); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerAdministratorResourceListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerAdministratorResourceListResult.java new file mode 100644 index 0000000000000..0024b8514110f --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerAdministratorResourceListResult.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list Active Directory Administrators request. */ +@Fluent +public final class ServerAdministratorResourceListResult { + /* + * The list of server Active Directory Administrators for the server. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of server Active Directory Administrators for the server. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server Active Directory Administrators for the server. + * + * @param value the value value to set. + * @return the ServerAdministratorResourceListResult object itself. + */ + public ServerAdministratorResourceListResult withValue(List value) { + this.value = value; + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerAdministrators.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerAdministrators.java new file mode 100644 index 0000000000000..fb35f6ce95d67 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerAdministrators.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.mysqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner; + +/** Resource collection API of ServerAdministrators. */ +public interface ServerAdministrators { + /** + * Gets information about a AAD server administrator. + * + * @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 information about a AAD server administrator. + */ + ServerAdministratorResource get(String resourceGroupName, String serverName); + + /** + * Gets information about a AAD server administrator. + * + * @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 information about a AAD server administrator along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @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 and external administrator to be created. + */ + ServerAdministratorResource createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties); + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @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 and external administrator to be created. + */ + ServerAdministratorResource createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context); + + /** + * Deletes server active directory administrator. + * + * @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. + */ + void deleteByResourceGroup(String resourceGroupName, String serverName); + + /** + * Deletes server active directory administrator. + * + * @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. + */ + void delete(String resourceGroupName, String serverName, Context context); + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serverName); + + /** + * Returns a list of server Administrators. + * + * @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 response to a list Active Directory Administrators request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerBackupListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerBackupListResult.java deleted file mode 100644 index 05be39163eb77..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerBackupListResult.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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerBackupInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** A list of server backups. */ -@Fluent -public final class ServerBackupListResult { - /* - * The list of backups of a server. - */ - @JsonProperty(value = "value") - private List value; - - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - - /** - * Get the value property: The list of backups of a server. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: The list of backups of a server. - * - * @param value the value value to set. - * @return the ServerBackupListResult object itself. - */ - public ServerBackupListResult 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 ServerBackupListResult object itself. - */ - public ServerBackupListResult 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerBasedPerformanceTiers.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerBasedPerformanceTiers.java new file mode 100644 index 0000000000000..4e20a6d1d21e7 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerBasedPerformanceTiers.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.mysqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ServerBasedPerformanceTiers. */ +public interface ServerBasedPerformanceTiers { + /** + * List all the performance tiers for a MySQL 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 performance tiers as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serverName); + + /** + * List all the performance tiers for a MySQL 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 performance tiers as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerEditionCapability.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerEditionCapability.java deleted file mode 100644 index b5af775d4688b..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerEditionCapability.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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Server edition capabilities. */ -@Immutable -public final class ServerEditionCapability { - /* - * Server edition name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * A list of supported storage editions - */ - @JsonProperty(value = "supportedStorageEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageEditions; - - /* - * A list of supported server versions. - */ - @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedServerVersions; - - /** - * Get the name property: Server edition name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedStorageEditions property: A list of supported storage editions. - * - * @return the supportedStorageEditions value. - */ - public List supportedStorageEditions() { - return this.supportedStorageEditions; - } - - /** - * Get the supportedServerVersions property: A list of supported server versions. - * - * @return the supportedServerVersions value. - */ - public List supportedServerVersions() { - return this.supportedServerVersions; - } - - /** - * 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()); - } - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerForCreate.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerForCreate.java new file mode 100644 index 0000000000000..c06f1104eb295 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerForCreate.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents a server to be created. */ +@Fluent +public final class ServerForCreate { + /* + * The Azure Active Directory identity of the server. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Properties of the server. + */ + @JsonProperty(value = "properties", required = true) + private ServerPropertiesForCreate properties; + + /* + * The location the resource resides in. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * 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; + + /** + * Get the identity property: The Azure Active Directory identity of the server. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The Azure Active Directory identity of the server. + * + * @param identity the identity value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku property: The SKU (pricing tier) of the server. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (pricing tier) of the server. + * + * @param sku the sku value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: Properties of the server. + * + * @return the properties value. + */ + public ServerPropertiesForCreate properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the server. + * + * @param properties the properties value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withProperties(ServerPropertiesForCreate properties) { + this.properties = properties; + return this; + } + + /** + * Get the location property: The location the resource resides in. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location the resource resides in. + * + * @param location the location value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withLocation(String location) { + this.location = location; + return this; + } + + /** + * 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 ServerForCreate object itself. + */ + public ServerForCreate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (properties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model ServerForCreate")); + } else { + properties().validate(); + } + if (location() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model ServerForCreate")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerForCreate.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKey.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKey.java new file mode 100644 index 0000000000000..ae6a35d3067eb --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKey.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerKeyInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ServerKey. */ +public interface ServerKey { + /** + * 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 kind property: Kind of encryption protector used to protect the key. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the serverKeyType property: The key type like 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * Gets the uri property: The URI of the key. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerKeyInner object. + * + * @return the inner object. + */ + ServerKeyInner innerModel(); + + /** The entirety of the ServerKey definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerKey definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerKey definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerKey definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies serverName, resourceGroupName. + * + * @param serverName The name of the server. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingServer(String serverName, String resourceGroupName); + } + /** + * The stage of the ServerKey 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.WithServerKeyType, DefinitionStages.WithUri { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerKey create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerKey create(Context context); + } + /** The stage of the ServerKey definition allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The key type like 'AzureKeyVault'.. + * + * @param serverKeyType The key type like 'AzureKeyVault'. + * @return the next definition stage. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ServerKey definition allowing to specify uri. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the key.. + * + * @param uri The URI of the key. + * @return the next definition stage. + */ + WithCreate withUri(String uri); + } + } + /** + * Begins update for the ServerKey resource. + * + * @return the stage of resource update. + */ + ServerKey.Update update(); + + /** The template for ServerKey update. */ + interface Update extends UpdateStages.WithServerKeyType, UpdateStages.WithUri { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerKey apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerKey apply(Context context); + } + /** The ServerKey update stages. */ + interface UpdateStages { + /** The stage of the ServerKey update allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The key type like 'AzureKeyVault'.. + * + * @param serverKeyType The key type like 'AzureKeyVault'. + * @return the next definition stage. + */ + Update withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ServerKey update allowing to specify uri. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the key.. + * + * @param uri The URI of the key. + * @return the next definition stage. + */ + Update withUri(String uri); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerKey refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerKey refresh(Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKeyListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKeyListResult.java new file mode 100644 index 0000000000000..045575aa07f5a --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKeyListResult.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerKeyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of MySQL Server keys. */ +@Immutable +public final class ServerKeyListResult { + /* + * A list of MySQL Server keys. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: A list of MySQL Server keys. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKeyType.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKeyType.java new file mode 100644 index 0000000000000..33f0bd8d0e2e7 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKeyType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerKeyType. */ +public final class ServerKeyType extends ExpandableStringEnum { + /** Static value AzureKeyVault for ServerKeyType. */ + public static final ServerKeyType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * Creates or finds a ServerKeyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerKeyType. + */ + @JsonCreator + public static ServerKeyType fromString(String name) { + return fromString(name, ServerKeyType.class); + } + + /** + * Gets known ServerKeyType values. + * + * @return known ServerKeyType values. + */ + public static Collection values() { + return values(ServerKeyType.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKeys.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKeys.java new file mode 100644 index 0000000000000..ec8aa30dba864 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerKeys.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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 ServerKeys. */ +public interface ServerKeys { + /** + * Gets a list of Server keys. + * + * @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 Server keys as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serverName); + + /** + * Gets a list of Server keys. + * + * @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 Server keys as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serverName, Context context); + + /** + * Gets a MySQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be retrieved. + * @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 MySQL Server key. + */ + ServerKey get(String resourceGroupName, String serverName, String keyName); + + /** + * Gets a MySQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be retrieved. + * @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 MySQL Server key along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String serverName, String keyName, Context context); + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String serverName, String keyName, String resourceGroupName); + + /** + * Deletes the MySQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the MySQL Server key to be deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String serverName, String keyName, String resourceGroupName, Context context); + + /** + * Gets a MySQL Server key. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MySQL Server key along with {@link Response}. + */ + ServerKey getById(String id); + + /** + * Gets a MySQL Server key. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MySQL Server key along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the MySQL Server key with the given name. + * + * @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 the MySQL Server key with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerKey resource. + * + * @param name resource name. + * @return the first stage of the new ServerKey definition. + */ + ServerKey.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerListResult.java index 6b32cafb7f4bc..98d5b7ed535d6 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerListResult.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerListResult.java @@ -18,12 +18,6 @@ public final class ServerListResult { @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - /** * Get the value property: The list of servers. * @@ -44,26 +38,6 @@ public ServerListResult withValue(List 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 ServerListResult object itself. - */ - public ServerListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerParameters.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerParameters.java new file mode 100644 index 0000000000000..fabb588f3309b --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerParameters.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; + +/** Resource collection API of ServerParameters. */ +public interface ServerParameters { + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 server configurations. + */ + ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value); + + /** + * Update a list of configurations 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 value The parameters for updating a list of server configuration. + * @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 server configurations. + */ + ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPrivateEndpointConnection.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPrivateEndpointConnection.java new file mode 100644 index 0000000000000..2e11b4a8f6345 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPrivateEndpointConnection.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection under a server. */ +@Immutable +public final class ServerPrivateEndpointConnection { + /* + * Resource Id of the private endpoint connection. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Private endpoint connection properties + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private ServerPrivateEndpointConnectionProperties properties; + + /** + * Get the id property: Resource Id of the private endpoint connection. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the properties property: Private endpoint connection properties. + * + * @return the properties value. + */ + public ServerPrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPrivateEndpointConnectionProperties.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..d0f27b1e8c6af --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPrivateEndpointConnectionProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class ServerPrivateEndpointConnectionProperties { + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointProvisioningState provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the ServerPrivateEndpointConnectionProperties object itself. + */ + public ServerPrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the ServerPrivateEndpointConnectionProperties object itself. + */ + public ServerPrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPrivateLinkServiceConnectionStateProperty.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..67c7318fd9943 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ServerPrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class ServerPrivateLinkServiceConnectionStateProperty { + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private PrivateLinkServiceConnectionStateStatus status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The actions required for private link service connection. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkServiceConnectionStateActionsRequire actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public PrivateLinkServiceConnectionStateStatus status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the ServerPrivateLinkServiceConnectionStateProperty object itself. + */ + public ServerPrivateLinkServiceConnectionStateProperty withStatus(PrivateLinkServiceConnectionStateStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the ServerPrivateLinkServiceConnectionStateProperty object itself. + */ + public ServerPrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: The actions required for private link service connection. + * + * @return the actionsRequired value. + */ + public PrivateLinkServiceConnectionStateActionsRequire actionsRequired() { + return this.actionsRequired; + } + + /** + * 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 ServerPrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model" + + " ServerPrivateLinkServiceConnectionStateProperty")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPrivateLinkServiceConnectionStateProperty.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForCreate.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForCreate.java new file mode 100644 index 0000000000000..e9e3668604e5a --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForCreate.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties used to create a new server. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "createMode", + defaultImpl = ServerPropertiesForCreate.class) +@JsonTypeName("ServerPropertiesForCreate") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Default", value = ServerPropertiesForDefaultCreate.class), + @JsonSubTypes.Type(name = "PointInTimeRestore", value = ServerPropertiesForRestore.class), + @JsonSubTypes.Type(name = "GeoRestore", value = ServerPropertiesForGeoRestore.class), + @JsonSubTypes.Type(name = "Replica", value = ServerPropertiesForReplica.class) +}) +@Fluent +public class ServerPropertiesForCreate { + /* + * Server version. + */ + @JsonProperty(value = "version") + private ServerVersion version; + + /* + * Enable ssl enforcement or not when connect to server. + */ + @JsonProperty(value = "sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /* + * Enforce a minimal Tls version for the server. + */ + @JsonProperty(value = "minimalTlsVersion") + private MinimalTlsVersionEnum minimalTlsVersion; + + /* + * Status showing whether the server enabled infrastructure encryption. + */ + @JsonProperty(value = "infrastructureEncryption") + private InfrastructureEncryption infrastructureEncryption; + + /* + * Whether or not public network access is allowed for this server. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; + + /* + * Storage profile of a server. + */ + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; + + /** + * Get the version property: Server version. + * + * @return the version value. + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version property: Server version. + * + * @param version the version value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @return the sslEnforcement value. + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @param sslEnforcement the sslEnforcement value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. + * + * @return the infrastructureEncryption value. + */ + public InfrastructureEncryption infrastructureEncryption() { + return this.infrastructureEncryption; + } + + /** + * Set the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. + * + * @param infrastructureEncryption the infrastructureEncryption value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { + this.infrastructureEncryption = infrastructureEncryption; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the storageProfile property: Storage profile of a server. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Storage profile of a server. + * + * @param storageProfile the storageProfile value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageProfile() != null) { + storageProfile().validate(); + } + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForDefaultCreate.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForDefaultCreate.java new file mode 100644 index 0000000000000..357ab48ec270b --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForDefaultCreate.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties used to create a new server. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("Default") +@Fluent +public final class ServerPropertiesForDefaultCreate extends ServerPropertiesForCreate { + /* + * The administrator's login name of a server. Can only be specified when + * the server is being created (and is required for creation). The login + * name is required when updating password. + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * Get the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). The login name is required when updating password. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). The login name is required when updating password. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerPropertiesForDefaultCreate object itself. + */ + public ServerPropertiesForDefaultCreate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerPropertiesForDefaultCreate object itself. + */ + public ServerPropertiesForDefaultCreate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + super.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withInfrastructureEncryption( + InfrastructureEncryption infrastructureEncryption) { + super.withInfrastructureEncryption(infrastructureEncryption); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (administratorLogin() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLogin in model ServerPropertiesForDefaultCreate")); + } + if (administratorLoginPassword() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLoginPassword in model" + + " ServerPropertiesForDefaultCreate")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPropertiesForDefaultCreate.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForGeoRestore.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForGeoRestore.java new file mode 100644 index 0000000000000..a28cfebfe77bb --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForGeoRestore.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties used to create a new server by restoring to a different region from a geo replicated backup. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("GeoRestore") +@Fluent +public final class ServerPropertiesForGeoRestore extends ServerPropertiesForCreate { + /* + * The source server id to restore from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /** + * Get the sourceServerId property: The source server id to restore from. + * + * @return the sourceServerId value. + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId property: The source server id to restore from. + * + * @param sourceServerId the sourceServerId value to set. + * @return the ServerPropertiesForGeoRestore object itself. + */ + public ServerPropertiesForGeoRestore withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + super.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withInfrastructureEncryption( + InfrastructureEncryption infrastructureEncryption) { + super.withInfrastructureEncryption(infrastructureEncryption); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceServerId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForGeoRestore")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPropertiesForGeoRestore.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForReplica.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForReplica.java new file mode 100644 index 0000000000000..41aa6c0891a6f --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForReplica.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties to create a new replica. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("Replica") +@Fluent +public final class ServerPropertiesForReplica extends ServerPropertiesForCreate { + /* + * The master server id to create replica from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /** + * Get the sourceServerId property: The master server id to create replica from. + * + * @return the sourceServerId value. + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId property: The master server id to create replica from. + * + * @param sourceServerId the sourceServerId value to set. + * @return the ServerPropertiesForReplica object itself. + */ + public ServerPropertiesForReplica withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + super.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { + super.withInfrastructureEncryption(infrastructureEncryption); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceServerId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForReplica")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPropertiesForReplica.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForRestore.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForRestore.java new file mode 100644 index 0000000000000..3903a008a61e1 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerPropertiesForRestore.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; + +/** The properties used to create a new server by restoring from a backup. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("PointInTimeRestore") +@Fluent +public final class ServerPropertiesForRestore extends ServerPropertiesForCreate { + /* + * The source server id to restore from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /* + * Restore point creation time (ISO8601 format), specifying the time to + * restore from. + */ + @JsonProperty(value = "restorePointInTime", required = true) + private OffsetDateTime restorePointInTime; + + /** + * Get the sourceServerId property: The source server id to restore from. + * + * @return the sourceServerId value. + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId property: The source server id to restore from. + * + * @param sourceServerId the sourceServerId value to set. + * @return the ServerPropertiesForRestore object itself. + */ + public ServerPropertiesForRestore withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** + * Get the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ServerPropertiesForRestore object itself. + */ + public ServerPropertiesForRestore withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + super.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { + super.withInfrastructureEncryption(infrastructureEncryption); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceServerId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForRestore")); + } + if (restorePointInTime() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property restorePointInTime in model ServerPropertiesForRestore")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPropertiesForRestore.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerRestartParameter.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerRestartParameter.java deleted file mode 100644 index 6e6567530721a..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerRestartParameter.java +++ /dev/null @@ -1,75 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Server restart parameters. */ -@Fluent -public final class ServerRestartParameter { - /* - * Whether or not failover to standby server when restarting a server with - * high availability enabled. - */ - @JsonProperty(value = "restartWithFailover") - private EnableStatusEnum restartWithFailover; - - /* - * The maximum allowed failover time in seconds. - */ - @JsonProperty(value = "maxFailoverSeconds") - private Integer maxFailoverSeconds; - - /** - * Get the restartWithFailover property: Whether or not failover to standby server when restarting a server with - * high availability enabled. - * - * @return the restartWithFailover value. - */ - public EnableStatusEnum restartWithFailover() { - return this.restartWithFailover; - } - - /** - * Set the restartWithFailover property: Whether or not failover to standby server when restarting a server with - * high availability enabled. - * - * @param restartWithFailover the restartWithFailover value to set. - * @return the ServerRestartParameter object itself. - */ - public ServerRestartParameter withRestartWithFailover(EnableStatusEnum restartWithFailover) { - this.restartWithFailover = restartWithFailover; - return this; - } - - /** - * Get the maxFailoverSeconds property: The maximum allowed failover time in seconds. - * - * @return the maxFailoverSeconds value. - */ - public Integer maxFailoverSeconds() { - return this.maxFailoverSeconds; - } - - /** - * Set the maxFailoverSeconds property: The maximum allowed failover time in seconds. - * - * @param maxFailoverSeconds the maxFailoverSeconds value to set. - * @return the ServerRestartParameter object itself. - */ - public ServerRestartParameter withMaxFailoverSeconds(Integer maxFailoverSeconds) { - this.maxFailoverSeconds = maxFailoverSeconds; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicies.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicies.java new file mode 100644 index 0000000000000..c2ebb917d8ce0 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicies.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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 ServerSecurityAlertPolicies. */ +public interface ServerSecurityAlertPolicies { + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy. + */ + ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @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 server's security alert policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context); + + /** + * Get the server's threat detection policies. + * + * @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 server's threat detection policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Get the server's threat detection policies. + * + * @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 server's threat detection policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Get a server's security alert policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy along with {@link Response}. + */ + ServerSecurityAlertPolicy getById(String id); + + /** + * Get a server's security alert policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ServerSecurityAlertPolicy definition. + */ + ServerSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyName name); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicy.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicy.java new file mode 100644 index 0000000000000..979949eaa1c1c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicy.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import java.util.List; + +/** An immutable client-side representation of ServerSecurityAlertPolicy. */ +public interface ServerSecurityAlertPolicy { + /** + * 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 state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @return the state value. + */ + ServerSecurityAlertPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner object. + * + * @return the inner object. + */ + ServerSecurityAlertPolicyInner innerModel(); + + /** The entirety of the ServerSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerSecurityAlertPolicy 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.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerSecurityAlertPolicy create(Context context); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled. + * @return the next definition stage. + */ + WithCreate withState(ServerSecurityAlertPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ServerSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + ServerSecurityAlertPolicy.Update update(); + + /** The template for ServerSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(Context context); + } + /** The ServerSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the ServerSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled. + * @return the next definition stage. + */ + Update withState(ServerSecurityAlertPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicyListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicyListResult.java new file mode 100644 index 0000000000000..cf77e17ef676c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicyListResult.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the server's security alert policies. */ +@Immutable +public final class ServerSecurityAlertPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicyState.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicyState.java new file mode 100644 index 0000000000000..772ce05cbc237 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerSecurityAlertPolicyState.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.mysqlflexibleserver.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ServerSecurityAlertPolicyState. */ +public enum ServerSecurityAlertPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ServerSecurityAlertPolicyState instance. */ + private final String value; + + ServerSecurityAlertPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServerSecurityAlertPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed ServerSecurityAlertPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static ServerSecurityAlertPolicyState fromString(String value) { + ServerSecurityAlertPolicyState[] items = ServerSecurityAlertPolicyState.values(); + for (ServerSecurityAlertPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerState.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerState.java index 61bcb6985ffd4..2e408559bdc4e 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerState.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerState.java @@ -19,17 +19,8 @@ public final class ServerState extends ExpandableStringEnum { /** Static value Disabled for ServerState. */ public static final ServerState DISABLED = fromString("Disabled"); - /** Static value Starting for ServerState. */ - public static final ServerState STARTING = fromString("Starting"); - - /** Static value Stopping for ServerState. */ - public static final ServerState STOPPING = fromString("Stopping"); - - /** Static value Stopped for ServerState. */ - public static final ServerState STOPPED = fromString("Stopped"); - - /** Static value Updating for ServerState. */ - public static final ServerState UPDATING = fromString("Updating"); + /** Static value Inaccessible for ServerState. */ + public static final ServerState INACCESSIBLE = fromString("Inaccessible"); /** * Creates or finds a ServerState from its string representation. @@ -42,7 +33,11 @@ public static ServerState fromString(String name) { return fromString(name, ServerState.class); } - /** @return known ServerState values. */ + /** + * Gets known ServerState values. + * + * @return known ServerState values. + */ public static Collection values() { return values(ServerState.class); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerForUpdate.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerUpdateParameters.java similarity index 51% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerForUpdate.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerUpdateParameters.java index fd7f308b38168..e8cb69cb2e92c 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerForUpdate.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerUpdateParameters.java @@ -5,19 +5,19 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerPropertiesForUpdate; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerUpdateParametersProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; /** Parameters allowed to update for a server. */ @Fluent -public final class ServerForUpdate { +public final class ServerUpdateParameters { /* - * The cmk identity for the server. + * The Azure Active Directory identity of the server. */ @JsonProperty(value = "identity") - private Identity identity; + private ResourceIdentity identity; /* * The SKU (pricing tier) of the server. @@ -29,7 +29,7 @@ public final class ServerForUpdate { * The properties that can be updated for a server. */ @JsonProperty(value = "properties") - private ServerPropertiesForUpdate innerProperties; + private ServerUpdateParametersProperties innerProperties; /* * Application-specific metadata in the form of key-value pairs. @@ -39,21 +39,21 @@ public final class ServerForUpdate { private Map tags; /** - * Get the identity property: The cmk identity for the server. + * Get the identity property: The Azure Active Directory identity of the server. * * @return the identity value. */ - public Identity identity() { + public ResourceIdentity identity() { return this.identity; } /** - * Set the identity property: The cmk identity for the server. + * Set the identity property: The Azure Active Directory identity of the server. * * @param identity the identity value to set. - * @return the ServerForUpdate object itself. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withIdentity(Identity identity) { + public ServerUpdateParameters withIdentity(ResourceIdentity identity) { this.identity = identity; return this; } @@ -71,9 +71,9 @@ public Sku sku() { * Set the sku property: The SKU (pricing tier) of the server. * * @param sku the sku value to set. - * @return the ServerForUpdate object itself. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withSku(Sku sku) { + public ServerUpdateParameters withSku(Sku sku) { this.sku = sku; return this; } @@ -83,7 +83,7 @@ public ServerForUpdate withSku(Sku sku) { * * @return the innerProperties value. */ - private ServerPropertiesForUpdate innerProperties() { + private ServerUpdateParametersProperties innerProperties() { return this.innerProperties; } @@ -100,171 +100,173 @@ public Map tags() { * Set the tags property: Application-specific metadata in the form of key-value pairs. * * @param tags the tags value to set. - * @return the ServerForUpdate object itself. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withTags(Map tags) { + public ServerUpdateParameters withTags(Map tags) { this.tags = tags; return this; } /** - * Get the administratorLoginPassword property: The password of the administrator login. + * Get the storageProfile property: Storage profile of a server. * - * @return the administratorLoginPassword value. + * @return the storageProfile value. */ - public String administratorLoginPassword() { - return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); + public StorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); } /** - * Set the administratorLoginPassword property: The password of the administrator login. + * Set the storageProfile property: Storage profile of a server. * - * @param administratorLoginPassword the administratorLoginPassword value to set. - * @return the ServerForUpdate object itself. + * @param storageProfile the storageProfile value to set. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + public ServerUpdateParameters withStorageProfile(StorageProfile storageProfile) { if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); + this.innerProperties = new ServerUpdateParametersProperties(); } - this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + this.innerProperties().withStorageProfile(storageProfile); return this; } /** - * Get the storage property: Storage related properties of a server. + * Get the administratorLoginPassword property: The password of the administrator login. * - * @return the storage value. + * @return the administratorLoginPassword value. */ - public Storage storage() { - return this.innerProperties() == null ? null : this.innerProperties().storage(); + public String administratorLoginPassword() { + return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); } /** - * Set the storage property: Storage related properties of a server. + * Set the administratorLoginPassword property: The password of the administrator login. * - * @param storage the storage value to set. - * @return the ServerForUpdate object itself. + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withStorage(Storage storage) { + public ServerUpdateParameters withAdministratorLoginPassword(String administratorLoginPassword) { if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); + this.innerProperties = new ServerUpdateParametersProperties(); } - this.innerProperties().withStorage(storage); + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); return this; } /** - * Get the backup property: Backup related properties of a server. + * Get the version property: The version of a server. * - * @return the backup value. + * @return the version value. */ - public Backup backup() { - return this.innerProperties() == null ? null : this.innerProperties().backup(); + public ServerVersion version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); } /** - * Set the backup property: Backup related properties of a server. + * Set the version property: The version of a server. * - * @param backup the backup value to set. - * @return the ServerForUpdate object itself. + * @param version the version value to set. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withBackup(Backup backup) { + public ServerUpdateParameters withVersion(ServerVersion version) { if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); + this.innerProperties = new ServerUpdateParametersProperties(); } - this.innerProperties().withBackup(backup); + this.innerProperties().withVersion(version); return this; } /** - * Get the highAvailability property: High availability related properties of a server. + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @return the highAvailability value. + * @return the sslEnforcement value. */ - public HighAvailability highAvailability() { - return this.innerProperties() == null ? null : this.innerProperties().highAvailability(); + public SslEnforcementEnum sslEnforcement() { + return this.innerProperties() == null ? null : this.innerProperties().sslEnforcement(); } /** - * Set the highAvailability property: High availability related properties of a server. + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @param highAvailability the highAvailability value to set. - * @return the ServerForUpdate object itself. + * @param sslEnforcement the sslEnforcement value to set. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withHighAvailability(HighAvailability highAvailability) { + public ServerUpdateParameters withSslEnforcement(SslEnforcementEnum sslEnforcement) { if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); + this.innerProperties = new ServerUpdateParametersProperties(); } - this.innerProperties().withHighAvailability(highAvailability); + this.innerProperties().withSslEnforcement(sslEnforcement); return this; } /** - * Get the maintenanceWindow property: Maintenance window of a server. + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the maintenanceWindow value. + * @return the minimalTlsVersion value. */ - public MaintenanceWindow maintenanceWindow() { - return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow(); + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); } /** - * Set the maintenanceWindow property: Maintenance window of a server. + * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @param maintenanceWindow the maintenanceWindow value to set. - * @return the ServerForUpdate object itself. + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + public ServerUpdateParameters withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); + this.innerProperties = new ServerUpdateParametersProperties(); } - this.innerProperties().withMaintenanceWindow(maintenanceWindow); + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); return this; } /** - * Get the replicationRole property: The replication role of the server. + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. * - * @return the replicationRole value. + * @return the publicNetworkAccess value. */ - public ReplicationRole replicationRole() { - return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); } /** - * Set the replicationRole property: The replication role of the server. + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. * - * @param replicationRole the replicationRole value to set. - * @return the ServerForUpdate object itself. + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withReplicationRole(ReplicationRole replicationRole) { + public ServerUpdateParameters withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); + this.innerProperties = new ServerUpdateParametersProperties(); } - this.innerProperties().withReplicationRole(replicationRole); + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); return this; } /** - * Get the dataEncryption property: The Data Encryption for CMK. + * Get the replicationRole property: The replication role of the server. * - * @return the dataEncryption value. + * @return the replicationRole value. */ - public DataEncryption dataEncryption() { - return this.innerProperties() == null ? null : this.innerProperties().dataEncryption(); + public String replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); } /** - * Set the dataEncryption property: The Data Encryption for CMK. + * Set the replicationRole property: The replication role of the server. * - * @param dataEncryption the dataEncryption value to set. - * @return the ServerForUpdate object itself. + * @param replicationRole the replicationRole value to set. + * @return the ServerUpdateParameters object itself. */ - public ServerForUpdate withDataEncryption(DataEncryption dataEncryption) { + public ServerUpdateParameters withReplicationRole(String replicationRole) { if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); + this.innerProperties = new ServerUpdateParametersProperties(); } - this.innerProperties().withDataEncryption(dataEncryption); + this.innerProperties().withReplicationRole(replicationRole); return this; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerUpgradeParameters.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerUpgradeParameters.java new file mode 100644 index 0000000000000..b7297d42432a5 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerUpgradeParameters.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerUpgradeParametersProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ServerUpgradeParameters model. */ +@Fluent +public final class ServerUpgradeParameters { + /* + * The properties that can be updated for a server. + */ + @JsonProperty(value = "properties") + private ServerUpgradeParametersProperties innerProperties; + + /** + * Get the innerProperties property: The properties that can be updated for a server. + * + * @return the innerProperties value. + */ + private ServerUpgradeParametersProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the targetServerVersion property: Represents an server storage profile. + * + * @return the targetServerVersion value. + */ + public String targetServerVersion() { + return this.innerProperties() == null ? null : this.innerProperties().targetServerVersion(); + } + + /** + * Set the targetServerVersion property: Represents an server storage profile. + * + * @param targetServerVersion the targetServerVersion value to set. + * @return the ServerUpgradeParameters object itself. + */ + public ServerUpgradeParameters withTargetServerVersion(String targetServerVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerUpgradeParametersProperties(); + } + this.innerProperties().withTargetServerVersion(targetServerVersion); + 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerVersion.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerVersion.java index 31c805f553d91..f506ad1e7a44a 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerVersion.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerVersion.java @@ -10,11 +10,14 @@ /** Defines values for ServerVersion. */ public final class ServerVersion extends ExpandableStringEnum { + /** Static value 5.6 for ServerVersion. */ + public static final ServerVersion FIVE_SIX = fromString("5.6"); + /** Static value 5.7 for ServerVersion. */ public static final ServerVersion FIVE_SEVEN = fromString("5.7"); - /** Static value 8.0.21 for ServerVersion. */ - public static final ServerVersion EIGHT_ZERO_TWO_ONE = fromString("8.0.21"); + /** Static value 8.0 for ServerVersion. */ + public static final ServerVersion EIGHT_ZERO = fromString("8.0"); /** * Creates or finds a ServerVersion from its string representation. @@ -27,7 +30,11 @@ public static ServerVersion fromString(String name) { return fromString(name, ServerVersion.class); } - /** @return known ServerVersion values. */ + /** + * Gets known ServerVersion values. + * + * @return known ServerVersion values. + */ public static Collection values() { return values(ServerVersion.class); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerVersionCapability.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerVersionCapability.java deleted file mode 100644 index b49e504bf9d3b..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerVersionCapability.java +++ /dev/null @@ -1,54 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Server version capabilities. */ -@Immutable -public final class ServerVersionCapability { - /* - * server version - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * A list of supported Skus - */ - @JsonProperty(value = "supportedSkus", access = JsonProperty.Access.WRITE_ONLY) - private List supportedSkus; - - /** - * Get the name property: server version. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedSkus property: A list of supported Skus. - * - * @return the supportedSkus value. - */ - public List supportedSkus() { - return this.supportedSkus; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedSkus() != null) { - supportedSkus().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Servers.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Servers.java index 12603747c3b04..058cd3bcd2662 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Servers.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Servers.java @@ -102,7 +102,7 @@ public interface Servers { PagedIterable list(Context context); /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -110,10 +110,10 @@ public interface Servers { * @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 failover(String resourceGroupName, String serverName); + void restart(String resourceGroupName, String serverName); /** - * Manual failover a server. + * Restarts a server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -122,35 +122,33 @@ public interface Servers { * @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 failover(String resourceGroupName, String serverName, Context context); + void restart(String resourceGroupName, String serverName, Context context); /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. */ - void restart(String resourceGroupName, String serverName, ServerRestartParameter parameters); + void start(String resourceGroupName, String serverName); /** - * Restarts a server. + * Starts a stopped server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The required parameters for restarting a 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. */ - void restart(String resourceGroupName, String serverName, ServerRestartParameter parameters, Context context); + void start(String resourceGroupName, String serverName, Context context); /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -158,10 +156,10 @@ public interface Servers { * @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 start(String resourceGroupName, String serverName); + void stop(String resourceGroupName, String serverName); /** - * Starts a server. + * Stops a running server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -170,30 +168,32 @@ public interface Servers { * @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 start(String resourceGroupName, String serverName, Context context); + void stop(String resourceGroupName, String serverName, Context context); /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. */ - void stop(String resourceGroupName, String serverName); + void upgrade(String resourceGroupName, String serverName, ServerUpgradeParameters parameters); /** - * Stops a server. + * Upgrade server version. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. + * @param parameters The required parameters for updating a 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. */ - void stop(String resourceGroupName, String serverName, Context context); + void upgrade(String resourceGroupName, String serverName, ServerUpgradeParameters parameters, Context context); /** * Gets information about a server. diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Sku.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Sku.java index ff4531f4eb3a9..6760878fcbdcd 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Sku.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Sku.java @@ -12,19 +12,38 @@ @Fluent public final class Sku { /* - * The name of the sku, e.g. Standard_D32s_v3. + * The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, + * GP_Gen5_8. */ @JsonProperty(value = "name", required = true) private String name; /* - * The tier of the particular SKU, e.g. GeneralPurpose. + * The tier of the particular SKU, e.g. Basic. */ - @JsonProperty(value = "tier", required = true) + @JsonProperty(value = "tier") private SkuTier tier; + /* + * The scale up/out capacity, representing server's compute units. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /* + * The size code, to be interpreted by resource as appropriate. + */ + @JsonProperty(value = "size") + private String size; + + /* + * The family of hardware. + */ + @JsonProperty(value = "family") + private String family; + /** - * Get the name property: The name of the sku, e.g. Standard_D32s_v3. + * Get the name property: The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. * * @return the name value. */ @@ -33,7 +52,7 @@ public String name() { } /** - * Set the name property: The name of the sku, e.g. Standard_D32s_v3. + * Set the name property: The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. * * @param name the name value to set. * @return the Sku object itself. @@ -44,7 +63,7 @@ public Sku withName(String name) { } /** - * Get the tier property: The tier of the particular SKU, e.g. GeneralPurpose. + * Get the tier property: The tier of the particular SKU, e.g. Basic. * * @return the tier value. */ @@ -53,7 +72,7 @@ public SkuTier tier() { } /** - * Set the tier property: The tier of the particular SKU, e.g. GeneralPurpose. + * Set the tier property: The tier of the particular SKU, e.g. Basic. * * @param tier the tier value to set. * @return the Sku object itself. @@ -63,6 +82,66 @@ public Sku withTier(SkuTier tier) { return this; } + /** + * Get the capacity property: The scale up/out capacity, representing server's compute units. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The scale up/out capacity, representing server's compute units. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the size property: The size code, to be interpreted by resource as appropriate. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The size code, to be interpreted by resource as appropriate. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: The family of hardware. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: The family of hardware. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + /** * Validates the instance. * @@ -73,10 +152,6 @@ public void validate() { throw LOGGER .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); } - if (tier() == null) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("Missing required property tier in model Sku")); - } } private static final ClientLogger LOGGER = new ClientLogger(Sku.class); diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SkuCapability.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SkuCapability.java deleted file mode 100644 index 749351357a3d5..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SkuCapability.java +++ /dev/null @@ -1,80 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Sku capability. */ -@Immutable -public final class SkuCapability { - /* - * 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; - - /** - * 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; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SkuTier.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SkuTier.java index c408cd1f40dee..a9f6572217b8a 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SkuTier.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SkuTier.java @@ -10,8 +10,8 @@ /** Defines values for SkuTier. */ public final class SkuTier extends ExpandableStringEnum { - /** Static value Burstable for SkuTier. */ - public static final SkuTier BURSTABLE = fromString("Burstable"); + /** Static value Basic for SkuTier. */ + public static final SkuTier BASIC = fromString("Basic"); /** Static value GeneralPurpose for SkuTier. */ public static final SkuTier GENERAL_PURPOSE = fromString("GeneralPurpose"); @@ -30,7 +30,11 @@ public static SkuTier fromString(String name) { return fromString(name, SkuTier.class); } - /** @return known SkuTier values. */ + /** + * Gets known SkuTier values. + * + * @return known SkuTier values. + */ public static Collection values() { return values(SkuTier.class); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DataEncryptionType.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SslEnforcementEnum.java similarity index 54% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DataEncryptionType.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SslEnforcementEnum.java index c3174dc4d4df7..c212f7ea6de2a 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/DataEncryptionType.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/SslEnforcementEnum.java @@ -7,31 +7,31 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for DataEncryptionType. */ -public enum DataEncryptionType { - /** Enum value AzureKeyVault. */ - AZURE_KEY_VAULT("AzureKeyVault"), +/** Defines values for SslEnforcementEnum. */ +public enum SslEnforcementEnum { + /** Enum value Enabled. */ + ENABLED("Enabled"), - /** Enum value SystemManaged. */ - SYSTEM_MANAGED("SystemManaged"); + /** Enum value Disabled. */ + DISABLED("Disabled"); - /** The actual serialized value for a DataEncryptionType instance. */ + /** The actual serialized value for a SslEnforcementEnum instance. */ private final String value; - DataEncryptionType(String value) { + SslEnforcementEnum(String value) { this.value = value; } /** - * Parses a serialized value to a DataEncryptionType instance. + * Parses a serialized value to a SslEnforcementEnum instance. * * @param value the serialized value to parse. - * @return the parsed DataEncryptionType object, or null if unable to parse. + * @return the parsed SslEnforcementEnum object, or null if unable to parse. */ @JsonCreator - public static DataEncryptionType fromString(String value) { - DataEncryptionType[] items = DataEncryptionType.values(); - for (DataEncryptionType item : items) { + public static SslEnforcementEnum fromString(String value) { + SslEnforcementEnum[] items = SslEnforcementEnum.values(); + for (SslEnforcementEnum item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Storage.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Storage.java deleted file mode 100644 index bc84ed25699ed..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Storage.java +++ /dev/null @@ -1,113 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Storage Profile properties of a server. */ -@Fluent -public final class Storage { - /* - * Max storage size allowed for a server. - */ - @JsonProperty(value = "storageSizeGB") - private Integer storageSizeGB; - - /* - * Storage IOPS for a server. - */ - @JsonProperty(value = "iops") - private Integer iops; - - /* - * Enable Storage Auto Grow or not. - */ - @JsonProperty(value = "autoGrow") - private EnableStatusEnum autoGrow; - - /* - * The sku name of the server storage. - */ - @JsonProperty(value = "storageSku", access = JsonProperty.Access.WRITE_ONLY) - private String storageSku; - - /** - * Get the storageSizeGB property: Max storage size allowed for a server. - * - * @return the storageSizeGB value. - */ - public Integer storageSizeGB() { - return this.storageSizeGB; - } - - /** - * Set the storageSizeGB property: Max storage size allowed for a server. - * - * @param storageSizeGB the storageSizeGB value to set. - * @return the Storage object itself. - */ - public Storage withStorageSizeGB(Integer storageSizeGB) { - this.storageSizeGB = storageSizeGB; - return this; - } - - /** - * Get the iops property: Storage IOPS for a server. - * - * @return the iops value. - */ - public Integer iops() { - return this.iops; - } - - /** - * Set the iops property: Storage IOPS for a server. - * - * @param iops the iops value to set. - * @return the Storage object itself. - */ - public Storage withIops(Integer iops) { - this.iops = iops; - return this; - } - - /** - * Get the autoGrow property: Enable Storage Auto Grow or not. - * - * @return the autoGrow value. - */ - public EnableStatusEnum autoGrow() { - return this.autoGrow; - } - - /** - * Set the autoGrow property: Enable Storage Auto Grow or not. - * - * @param autoGrow the autoGrow value to set. - * @return the Storage object itself. - */ - public Storage withAutoGrow(EnableStatusEnum autoGrow) { - this.autoGrow = autoGrow; - return this; - } - - /** - * Get the storageSku property: The sku name of the server storage. - * - * @return the storageSku value. - */ - public String storageSku() { - return this.storageSku; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/StorageAutogrow.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/StorageAutogrow.java new file mode 100644 index 0000000000000..bb18d763f7a7b --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/StorageAutogrow.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageAutogrow. */ +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 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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/StorageEditionCapability.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/StorageEditionCapability.java deleted file mode 100644 index c737ba20a89f5..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/StorageEditionCapability.java +++ /dev/null @@ -1,95 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** storage edition capability. */ -@Immutable -public final class StorageEditionCapability { - /* - * storage edition name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The minimal supported storage size. - */ - @JsonProperty(value = "minStorageSize", access = JsonProperty.Access.WRITE_ONLY) - private Long minStorageSize; - - /* - * The maximum supported storage size. - */ - @JsonProperty(value = "maxStorageSize", access = JsonProperty.Access.WRITE_ONLY) - private Long maxStorageSize; - - /* - * Minimal backup retention days - */ - @JsonProperty(value = "minBackupRetentionDays", access = JsonProperty.Access.WRITE_ONLY) - private Long minBackupRetentionDays; - - /* - * Maximum backup retention days - */ - @JsonProperty(value = "maxBackupRetentionDays", access = JsonProperty.Access.WRITE_ONLY) - private Long maxBackupRetentionDays; - - /** - * Get the name property: storage edition name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the minStorageSize property: The minimal supported storage size. - * - * @return the minStorageSize value. - */ - public Long minStorageSize() { - return this.minStorageSize; - } - - /** - * Get the maxStorageSize property: The maximum supported storage size. - * - * @return the maxStorageSize value. - */ - public Long maxStorageSize() { - return this.maxStorageSize; - } - - /** - * Get the minBackupRetentionDays property: Minimal backup retention days. - * - * @return the minBackupRetentionDays value. - */ - public Long minBackupRetentionDays() { - return this.minBackupRetentionDays; - } - - /** - * Get the maxBackupRetentionDays property: Maximum backup retention days. - * - * @return the maxBackupRetentionDays value. - */ - public Long maxBackupRetentionDays() { - return this.maxBackupRetentionDays; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/StorageProfile.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/StorageProfile.java new file mode 100644 index 0000000000000..79c60318b04a0 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/StorageProfile.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Storage Profile properties of a server. */ +@Fluent +public final class StorageProfile { + /* + * Backup retention days for the server. + */ + @JsonProperty(value = "backupRetentionDays") + private Integer backupRetentionDays; + + /* + * Enable Geo-redundant or not for server backup. + */ + @JsonProperty(value = "geoRedundantBackup") + private GeoRedundantBackup geoRedundantBackup; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "storageMB") + private Integer storageMB; + + /* + * Enable Storage Auto Grow. + */ + @JsonProperty(value = "storageAutogrow") + private StorageAutogrow storageAutogrow; + + /** + * Get the backupRetentionDays property: Backup retention days for the server. + * + * @return the backupRetentionDays value. + */ + public Integer backupRetentionDays() { + return this.backupRetentionDays; + } + + /** + * Set the backupRetentionDays property: Backup retention days for the server. + * + * @param backupRetentionDays the backupRetentionDays value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withBackupRetentionDays(Integer backupRetentionDays) { + this.backupRetentionDays = backupRetentionDays; + return this; + } + + /** + * Get the geoRedundantBackup property: Enable Geo-redundant or not for server backup. + * + * @return the geoRedundantBackup value. + */ + public GeoRedundantBackup geoRedundantBackup() { + return this.geoRedundantBackup; + } + + /** + * Set the geoRedundantBackup property: Enable Geo-redundant or not for server backup. + * + * @param geoRedundantBackup the geoRedundantBackup value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withGeoRedundantBackup(GeoRedundantBackup geoRedundantBackup) { + this.geoRedundantBackup = geoRedundantBackup; + return this; + } + + /** + * Get the storageMB property: Max storage allowed for a server. + * + * @return the storageMB value. + */ + public Integer storageMB() { + return this.storageMB; + } + + /** + * Set the storageMB property: Max storage allowed for a server. + * + * @param storageMB the storageMB value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withStorageMB(Integer storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get the storageAutogrow property: Enable Storage Auto Grow. + * + * @return the storageAutogrow value. + */ + public StorageAutogrow storageAutogrow() { + return this.storageAutogrow; + } + + /** + * Set the storageAutogrow property: Enable Storage Auto Grow. + * + * @param storageAutogrow the storageAutogrow value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withStorageAutogrow(StorageAutogrow storageAutogrow) { + this.storageAutogrow = storageAutogrow; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TagsObject.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TagsObject.java new file mode 100644 index 0000000000000..ad0574f19381b --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TagsObject.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Tags object for patch operations. */ +@Fluent +public final class TagsObject { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TagsObject object itself. + */ + public TagsObject withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TopQueryStatistics.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TopQueryStatistics.java new file mode 100644 index 0000000000000..09fc788fc37d5 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TopQueryStatistics.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.mysqlflexibleserver.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 TopQueryStatistics. */ +public interface TopQueryStatistics { + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @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 Query Statistic. + */ + QueryStatistic get(String resourceGroupName, String serverName, String queryStatisticId); + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @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 Query Statistic along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String queryStatisticId, Context context); + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @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 query statistics as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters); + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @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 query statistics as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TopQueryStatisticsInput.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TopQueryStatisticsInput.java new file mode 100644 index 0000000000000..9f58647eae5a1 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TopQueryStatisticsInput.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.TopQueryStatisticsInputProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Input to get top query statistics. */ +@Fluent +public final class TopQueryStatisticsInput { + /* + * The properties of a wait statistics input. + */ + @JsonProperty(value = "properties", required = true) + private TopQueryStatisticsInputProperties innerProperties = new TopQueryStatisticsInputProperties(); + + /** + * Get the innerProperties property: The properties of a wait statistics input. + * + * @return the innerProperties value. + */ + private TopQueryStatisticsInputProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the numberOfTopQueries property: Max number of top queries to return. + * + * @return the numberOfTopQueries value. + */ + public int numberOfTopQueries() { + return this.innerProperties() == null ? 0 : this.innerProperties().numberOfTopQueries(); + } + + /** + * Set the numberOfTopQueries property: Max number of top queries to return. + * + * @param numberOfTopQueries the numberOfTopQueries value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withNumberOfTopQueries(int numberOfTopQueries) { + if (this.innerProperties() == null) { + this.innerProperties = new TopQueryStatisticsInputProperties(); + } + this.innerProperties().withNumberOfTopQueries(numberOfTopQueries); + return this; + } + + /** + * Get the aggregationFunction property: Aggregation function name. + * + * @return the aggregationFunction value. + */ + public String aggregationFunction() { + return this.innerProperties() == null ? null : this.innerProperties().aggregationFunction(); + } + + /** + * Set the aggregationFunction property: Aggregation function name. + * + * @param aggregationFunction the aggregationFunction value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withAggregationFunction(String aggregationFunction) { + if (this.innerProperties() == null) { + this.innerProperties = new TopQueryStatisticsInputProperties(); + } + this.innerProperties().withAggregationFunction(aggregationFunction); + return this; + } + + /** + * Get the observedMetric property: Observed metric name. + * + * @return the observedMetric value. + */ + public String observedMetric() { + return this.innerProperties() == null ? null : this.innerProperties().observedMetric(); + } + + /** + * Set the observedMetric property: Observed metric name. + * + * @param observedMetric the observedMetric value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withObservedMetric(String observedMetric) { + if (this.innerProperties() == null) { + this.innerProperties = new TopQueryStatisticsInputProperties(); + } + this.innerProperties().withObservedMetric(observedMetric); + return this; + } + + /** + * Get the observationStartTime property: Observation start time. + * + * @return the observationStartTime value. + */ + public OffsetDateTime observationStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().observationStartTime(); + } + + /** + * Set the observationStartTime property: Observation start time. + * + * @param observationStartTime the observationStartTime value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withObservationStartTime(OffsetDateTime observationStartTime) { + if (this.innerProperties() == null) { + this.innerProperties = new TopQueryStatisticsInputProperties(); + } + this.innerProperties().withObservationStartTime(observationStartTime); + return this; + } + + /** + * Get the observationEndTime property: Observation end time. + * + * @return the observationEndTime value. + */ + public OffsetDateTime observationEndTime() { + return this.innerProperties() == null ? null : this.innerProperties().observationEndTime(); + } + + /** + * Set the observationEndTime property: Observation end time. + * + * @param observationEndTime the observationEndTime value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withObservationEndTime(OffsetDateTime observationEndTime) { + if (this.innerProperties() == null) { + this.innerProperties = new TopQueryStatisticsInputProperties(); + } + this.innerProperties().withObservationEndTime(observationEndTime); + return this; + } + + /** + * Get the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @return the aggregationWindow value. + */ + public String aggregationWindow() { + return this.innerProperties() == null ? null : this.innerProperties().aggregationWindow(); + } + + /** + * Set the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @param aggregationWindow the aggregationWindow value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withAggregationWindow(String aggregationWindow) { + if (this.innerProperties() == null) { + this.innerProperties = new TopQueryStatisticsInputProperties(); + } + this.innerProperties().withAggregationWindow(aggregationWindow); + 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 TopQueryStatisticsInput")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TopQueryStatisticsInput.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CapabilitiesListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TopQueryStatisticsResultList.java similarity index 79% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CapabilitiesListResult.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TopQueryStatisticsResultList.java index 768033bf09f75..2855452f1a84c 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/CapabilitiesListResult.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/TopQueryStatisticsResultList.java @@ -5,18 +5,18 @@ package com.azure.resourcemanager.mysqlflexibleserver.models; import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.QueryStatisticInner; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** location capability. */ +/** A list of query statistics. */ @Immutable -public final class CapabilitiesListResult { +public final class TopQueryStatisticsResultList { /* - * A list of supported capabilities. + * The list of top query statistics. */ @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) - private List value; + private List value; /* * Link to retrieve next page of results. @@ -25,11 +25,11 @@ public final class CapabilitiesListResult { private String nextLink; /** - * Get the value property: A list of supported capabilities. + * Get the value property: The list of top query statistics. * * @return the value value. */ - public List value() { + public List value() { return this.value; } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRule.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRule.java new file mode 100644 index 0000000000000..cc6ca7a0db012 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRule.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkRuleInner; + +/** An immutable client-side representation of VirtualNetworkRule. */ +public interface VirtualNetworkRule { + /** + * 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 virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + String virtualNetworkSubnetId(); + + /** + * Gets the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + Boolean ignoreMissingVnetServiceEndpoint(); + + /** + * Gets the state property: Virtual Network Rule State. + * + * @return the state value. + */ + VirtualNetworkRuleState state(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkRuleInner object. + * + * @return the inner object. + */ + VirtualNetworkRuleInner innerModel(); + + /** The entirety of the VirtualNetworkRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The VirtualNetworkRule definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualNetworkRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the VirtualNetworkRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the VirtualNetworkRule 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.WithVirtualNetworkSubnetId, DefinitionStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualNetworkRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualNetworkRule create(Context context); + } + /** The stage of the VirtualNetworkRule definition allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + WithCreate withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule definition allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + WithCreate withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Begins update for the VirtualNetworkRule resource. + * + * @return the stage of resource update. + */ + VirtualNetworkRule.Update update(); + + /** The template for VirtualNetworkRule update. */ + interface Update + extends UpdateStages.WithVirtualNetworkSubnetId, UpdateStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualNetworkRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualNetworkRule apply(Context context); + } + /** The VirtualNetworkRule update stages. */ + interface UpdateStages { + /** The stage of the VirtualNetworkRule update allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + Update withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule update allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + Update withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRuleListResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRuleListResult.java new file mode 100644 index 0000000000000..e53be81f7676d --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRuleListResult.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of virtual network rules. */ +@Immutable +public final class VirtualNetworkRuleListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRuleState.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRuleState.java new file mode 100644 index 0000000000000..23043cbbf73c2 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRuleState.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.mysqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualNetworkRuleState. */ +public final class VirtualNetworkRuleState extends ExpandableStringEnum { + /** Static value Initializing for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState INITIALIZING = fromString("Initializing"); + + /** Static value InProgress for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState IN_PROGRESS = fromString("InProgress"); + + /** Static value Ready for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState READY = fromString("Ready"); + + /** Static value Deleting for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState DELETING = fromString("Deleting"); + + /** Static value Unknown for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a VirtualNetworkRuleState from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualNetworkRuleState. + */ + @JsonCreator + public static VirtualNetworkRuleState fromString(String name) { + return fromString(name, VirtualNetworkRuleState.class); + } + + /** + * Gets known VirtualNetworkRuleState values. + * + * @return known VirtualNetworkRuleState values. + */ + public static Collection values() { + return values(VirtualNetworkRuleState.class); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRules.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRules.java new file mode 100644 index 0000000000000..01f5a27390e54 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkRules.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.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 VirtualNetworkRules. */ +public interface VirtualNetworkRules { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Gets a list of virtual network rules in a 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 virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of virtual network rules in a 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 virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a virtual network rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + VirtualNetworkRule getById(String id); + + /** + * Gets a virtual network rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @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 the virtual network rule with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new VirtualNetworkRule resource. + * + * @param name resource name. + * @return the first stage of the new VirtualNetworkRule definition. + */ + VirtualNetworkRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java deleted file mode 100644 index c4b1296b83214..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java +++ /dev/null @@ -1,46 +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.mysqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Virtual network subnet usage parameter. */ -@Fluent -public final class VirtualNetworkSubnetUsageParameter { - /* - * Virtual network resource id. - */ - @JsonProperty(value = "virtualNetworkResourceId") - private String virtualNetworkResourceId; - - /** - * Get the virtualNetworkResourceId property: Virtual network resource id. - * - * @return the virtualNetworkResourceId value. - */ - public String virtualNetworkResourceId() { - return this.virtualNetworkResourceId; - } - - /** - * Set the virtualNetworkResourceId property: Virtual network resource id. - * - * @param virtualNetworkResourceId the virtualNetworkResourceId value to set. - * @return the VirtualNetworkSubnetUsageParameter object itself. - */ - public VirtualNetworkSubnetUsageParameter withVirtualNetworkResourceId(String virtualNetworkResourceId) { - this.virtualNetworkResourceId = virtualNetworkResourceId; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java deleted file mode 100644 index 159abeda063ee..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java +++ /dev/null @@ -1,26 +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.mysqlflexibleserver.models; - -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import java.util.List; - -/** An immutable client-side representation of VirtualNetworkSubnetUsageResult. */ -public interface VirtualNetworkSubnetUsageResult { - /** - * Gets the delegatedSubnetsUsage property: A list of delegated subnet usage. - * - * @return the delegatedSubnetsUsage value. - */ - List delegatedSubnetsUsage(); - - /** - * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner - * object. - * - * @return the inner object. - */ - VirtualNetworkSubnetUsageResultInner innerModel(); -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatistic.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatistic.java new file mode 100644 index 0000000000000..940dc92c79ac7 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatistic.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.mysqlflexibleserver.models; + +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.WaitStatisticInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of WaitStatistic. */ +public interface WaitStatistic { + /** + * 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 startTime property: Observation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: Observation end time. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the eventName property: Wait event name. + * + * @return the eventName value. + */ + String eventName(); + + /** + * Gets the eventTypeName property: Wait event type name. + * + * @return the eventTypeName value. + */ + String eventTypeName(); + + /** + * Gets the queryId property: Database query identifier. + * + * @return the queryId value. + */ + Long queryId(); + + /** + * Gets the databaseName property: Database Name. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the userId property: Database user identifier. + * + * @return the userId value. + */ + Long userId(); + + /** + * Gets the count property: Wait event count observed in this time interval. + * + * @return the count value. + */ + Long count(); + + /** + * Gets the totalTimeInMs property: Total time of wait in milliseconds in this time interval. + * + * @return the totalTimeInMs value. + */ + Double totalTimeInMs(); + + /** + * Gets the inner com.azure.resourcemanager.mysqlflexibleserver.fluent.models.WaitStatisticInner object. + * + * @return the inner object. + */ + WaitStatisticInner innerModel(); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatistics.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatistics.java new file mode 100644 index 0000000000000..25560551afb03 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatistics.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.mysqlflexibleserver.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 WaitStatistics. */ +public interface WaitStatistics { + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @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 Wait Statistic. + */ + WaitStatistic get(String resourceGroupName, String serverName, String waitStatisticsId); + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @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 Wait Statistic along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String waitStatisticsId, Context context); + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @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 wait statistics as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters); + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @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 wait statistics as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatisticsInput.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatisticsInput.java new file mode 100644 index 0000000000000..3ae5dccb78ca6 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatisticsInput.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.WaitStatisticsInputProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Input to get wait statistics. */ +@Fluent +public final class WaitStatisticsInput { + /* + * The properties of a wait statistics input. + */ + @JsonProperty(value = "properties", required = true) + private WaitStatisticsInputProperties innerProperties = new WaitStatisticsInputProperties(); + + /** + * Get the innerProperties property: The properties of a wait statistics input. + * + * @return the innerProperties value. + */ + private WaitStatisticsInputProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the observationStartTime property: Observation start time. + * + * @return the observationStartTime value. + */ + public OffsetDateTime observationStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().observationStartTime(); + } + + /** + * Set the observationStartTime property: Observation start time. + * + * @param observationStartTime the observationStartTime value to set. + * @return the WaitStatisticsInput object itself. + */ + public WaitStatisticsInput withObservationStartTime(OffsetDateTime observationStartTime) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticsInputProperties(); + } + this.innerProperties().withObservationStartTime(observationStartTime); + return this; + } + + /** + * Get the observationEndTime property: Observation end time. + * + * @return the observationEndTime value. + */ + public OffsetDateTime observationEndTime() { + return this.innerProperties() == null ? null : this.innerProperties().observationEndTime(); + } + + /** + * Set the observationEndTime property: Observation end time. + * + * @param observationEndTime the observationEndTime value to set. + * @return the WaitStatisticsInput object itself. + */ + public WaitStatisticsInput withObservationEndTime(OffsetDateTime observationEndTime) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticsInputProperties(); + } + this.innerProperties().withObservationEndTime(observationEndTime); + return this; + } + + /** + * Get the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @return the aggregationWindow value. + */ + public String aggregationWindow() { + return this.innerProperties() == null ? null : this.innerProperties().aggregationWindow(); + } + + /** + * Set the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @param aggregationWindow the aggregationWindow value to set. + * @return the WaitStatisticsInput object itself. + */ + public WaitStatisticsInput withAggregationWindow(String aggregationWindow) { + if (this.innerProperties() == null) { + this.innerProperties = new WaitStatisticsInputProperties(); + } + this.innerProperties().withAggregationWindow(aggregationWindow); + 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 WaitStatisticsInput")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WaitStatisticsInput.class); +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatisticsResultList.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatisticsResultList.java new file mode 100644 index 0000000000000..48e546aa24b30 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/WaitStatisticsResultList.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.mysqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.WaitStatisticInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of wait statistics. */ +@Immutable +public final class WaitStatisticsResultList { + /* + * The list of wait statistics. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of wait statistics. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedCapabilitiesListSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/AdvisorsGetSamples.java similarity index 50% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedCapabilitiesListSamples.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/AdvisorsGetSamples.java index 0ac876d967d1b..026ac6973ab67 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedCapabilitiesListSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/AdvisorsGetSamples.java @@ -6,17 +6,17 @@ import com.azure.core.util.Context; -/** Samples for LocationBasedCapabilities List. */ -public final class LocationBasedCapabilitiesListSamples { +/** Samples for Advisors Get. */ +public final class AdvisorsGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/CapabilitiesByLocationList.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/AdvisorsGet.json */ /** - * Sample code: CapabilitiesList. + * Sample code: AdvisorsGet. * * @param manager Entry point to MySqlManager. */ - public static void capabilitiesList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.locationBasedCapabilities().list("WestUS", Context.NONE); + public static void advisorsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.advisors().getWithResponse("testResourceGroupName", "testServerName", "Index", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/AdvisorsListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/AdvisorsListByServerSamples.java new file mode 100644 index 0000000000000..51ef4cf987c94 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/AdvisorsListByServerSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for Advisors ListByServer. */ +public final class AdvisorsListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/AdvisorsListByServer.json + */ + /** + * Sample code: AdvisorsListByServer. + * + * @param manager Entry point to MySqlManager. + */ + public static void advisorsListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.advisors().listByServer("testResourceGroupName", "testServerName", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java index a11287876b083..029de3575571d 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java @@ -10,19 +10,17 @@ /** Samples for CheckNameAvailability Execute. */ public final class CheckNameAvailabilityExecuteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/CheckNameAvailability.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/CheckNameAvailability.json */ /** - * Sample code: Check name availability. + * Sample code: NameAvailability. * * @param manager Entry point to MySqlManager. */ - public static void checkNameAvailability(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void nameAvailability(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .checkNameAvailabilities() .executeWithResponse( - "SouthEastAsia", - new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforMySQL/flexibleServers"), - Context.NONE); + new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforMySQL"), Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/CheckVirtualNetworkSubnetUsageExecuteSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/CheckVirtualNetworkSubnetUsageExecuteSamples.java deleted file mode 100644 index bf3aa760068e6..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/CheckVirtualNetworkSubnetUsageExecuteSamples.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.mysqlflexibleserver.generated; - -import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; - -/** Samples for CheckVirtualNetworkSubnetUsage Execute. */ -public final class CheckVirtualNetworkSubnetUsageExecuteSamples { - /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/CheckVirtualNetworkSubnetUsage.json - */ - /** - * Sample code: CheckVirtualNetworkSubnetUsage. - * - * @param manager Entry point to MySqlManager. - */ - public static void checkVirtualNetworkSubnetUsage( - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager - .checkVirtualNetworkSubnetUsages() - .executeWithResponse( - "WestUS", - new VirtualNetworkSubnetUsageParameter() - .withVirtualNetworkResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet"), - Context.NONE); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsBatchUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsBatchUpdateSamples.java deleted file mode 100644 index 545bca76d7dcb..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsBatchUpdateSamples.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.mysqlflexibleserver.generated; - -import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationForBatchUpdate; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationListForBatchUpdate; -import java.util.Arrays; - -/** Samples for Configurations BatchUpdate. */ -public final class ConfigurationsBatchUpdateSamples { - /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationsBatchUpdate.json - */ - /** - * Sample code: ConfigurationList. - * - * @param manager Entry point to MySqlManager. - */ - public static void configurationList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager - .configurations() - .batchUpdate( - "testrg", - "mysqltestserver", - new ConfigurationListForBatchUpdate() - .withValue( - Arrays - .asList( - new ConfigurationForBatchUpdate().withName("event_scheduler").withValue("OFF"), - new ConfigurationForBatchUpdate().withName("div_precision_increment").withValue("8"))), - Context.NONE); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsCreateOrUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..7bfaec036ba5a --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsCreateOrUpdateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +/** Samples for Configurations CreateOrUpdate. */ +public final class ConfigurationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json + */ + /** + * Sample code: ConfigurationCreateOrUpdate. + * + * @param manager Entry point to MySqlManager. + */ + public static void configurationCreateOrUpdate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .configurations() + .define("event_scheduler") + .withExistingServer("TestGroup", "testserver") + .withValue("off") + .withSource("user-override") + .create(); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsGetSamples.java index 507664d01d3fa..25f4b374fb4c7 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsGetSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsGetSamples.java @@ -9,14 +9,14 @@ /** Samples for Configurations Get. */ public final class ConfigurationsGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationGet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationGet.json */ /** - * Sample code: Get a configuration. + * Sample code: ConfigurationGet. * * @param manager Entry point to MySqlManager. */ - public static void getAConfiguration(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void configurationGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.configurations().getWithResponse("TestGroup", "testserver", "event_scheduler", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsListByServerSamples.java index cc2646d44decd..8db6f01268136 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsListByServerSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsListByServerSamples.java @@ -9,15 +9,14 @@ /** Samples for Configurations ListByServer. */ public final class ConfigurationsListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationsListByServer.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationListByServer.json */ /** - * Sample code: List all configurations for a server. + * Sample code: ConfigurationList. * * @param manager Entry point to MySqlManager. */ - public static void listAllConfigurationsForAServer( - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.configurations().listByServer("testrg", "mysqltestserver", Context.NONE); + public static void configurationList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.configurations().listByServer("testrg", "mysqltestsvc1", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsUpdateSamples.java deleted file mode 100644 index b32e5d902fbc4..0000000000000 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ConfigurationsUpdateSamples.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.mysqlflexibleserver.generated; - -import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationInner; -import com.azure.resourcemanager.mysqlflexibleserver.models.ConfigurationSource; - -/** Samples for Configurations Update. */ -public final class ConfigurationsUpdateSamples { - /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ConfigurationUpdate.json - */ - /** - * Sample code: Update a user configuration. - * - * @param manager Entry point to MySqlManager. - */ - public static void updateAUserConfiguration(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager - .configurations() - .update( - "testrg", - "testserver", - "event_scheduler", - new ConfigurationInner().withValue("on").withSource(ConfigurationSource.USER_OVERRIDE), - Context.NONE); - } -} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesCreateOrUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesCreateOrUpdateSamples.java index 8237d90fbcc31..5b172f765808c 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesCreateOrUpdateSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesCreateOrUpdateSamples.java @@ -7,18 +7,18 @@ /** Samples for Databases CreateOrUpdate. */ public final class DatabasesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabaseCreate.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseCreate.json */ /** - * Sample code: Create a database. + * Sample code: DatabaseCreate. * * @param manager Entry point to MySqlManager. */ - public static void createADatabase(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void databaseCreate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .databases() .define("db1") - .withExistingFlexibleServer("TestGroup", "testserver") + .withExistingServer("TestGroup", "testserver") .withCharset("utf8") .withCollation("utf8_general_ci") .create(); diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesDeleteSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesDeleteSamples.java index 85206e67fbdb0..e8cc72452c3c3 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesDeleteSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesDeleteSamples.java @@ -9,14 +9,14 @@ /** Samples for Databases Delete. */ public final class DatabasesDeleteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabaseDelete.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseDelete.json */ /** - * Sample code: Delete a database. + * Sample code: DatabaseDelete. * * @param manager Entry point to MySqlManager. */ - public static void deleteADatabase(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void databaseDelete(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.databases().delete("TestGroup", "testserver", "db1", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesGetSamples.java index 8077d3c7cdae7..b78fc40932c80 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesGetSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesGetSamples.java @@ -9,14 +9,14 @@ /** Samples for Databases Get. */ public final class DatabasesGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabaseGet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseGet.json */ /** - * Sample code: Get a database. + * Sample code: DatabaseGet. * * @param manager Entry point to MySqlManager. */ - public static void getADatabase(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void databaseGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.databases().getWithResponse("TestGroup", "testserver", "db1", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesListByServerSamples.java index b60235091cb2e..e004791b51f8f 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesListByServerSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/DatabasesListByServerSamples.java @@ -9,14 +9,14 @@ /** Samples for Databases ListByServer. */ public final class DatabasesListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/DatabasesListByServer.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseListByServer.json */ /** - * Sample code: List databases in a server. + * Sample code: DatabaseList. * * @param manager Entry point to MySqlManager. */ - public static void listDatabasesInAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void databaseList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.databases().listByServer("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java index 6ad50e38aa52e..6a55d068c4e50 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java @@ -7,18 +7,18 @@ /** Samples for FirewallRules CreateOrUpdate. */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRuleCreate.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleCreate.json */ /** - * Sample code: Create a firewall rule. + * Sample code: FirewallRuleCreate. * * @param manager Entry point to MySqlManager. */ - public static void createAFirewallRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void firewallRuleCreate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .firewallRules() .define("rule1") - .withExistingFlexibleServer("TestGroup", "testserver") + .withExistingServer("TestGroup", "testserver") .withStartIpAddress("0.0.0.0") .withEndIpAddress("255.255.255.255") .create(); diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesDeleteSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesDeleteSamples.java index 8cd07f03c80de..62e10bb011ed4 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesDeleteSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesDeleteSamples.java @@ -9,14 +9,14 @@ /** Samples for FirewallRules Delete. */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRuleDelete.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleDelete.json */ /** - * Sample code: Delete a firewall rule. + * Sample code: FirewallRuleDelete. * * @param manager Entry point to MySqlManager. */ - public static void deleteAFirewallRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void firewallRuleDelete(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.firewallRules().delete("TestGroup", "testserver", "rule1", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesGetSamples.java index 5537baa79e756..76e10c3f26eb6 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesGetSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesGetSamples.java @@ -9,14 +9,14 @@ /** Samples for FirewallRules Get. */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRuleGet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleGet.json */ /** - * Sample code: Get a firewall rule. + * Sample code: FirewallRuleGet. * * @param manager Entry point to MySqlManager. */ - public static void getAFirewallRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void firewallRuleGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.firewallRules().getWithResponse("TestGroup", "testserver", "rule1", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesListByServerSamples.java index 6aa5f72789b3c..4d35396c830bb 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesListByServerSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/FirewallRulesListByServerSamples.java @@ -9,15 +9,14 @@ /** Samples for FirewallRules ListByServer. */ public final class FirewallRulesListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/FirewallRulesListByServer.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleListByServer.json */ /** - * Sample code: List all firewall rules in a server. + * Sample code: FirewallRuleList. * * @param manager Entry point to MySqlManager. */ - public static void listAllFirewallRulesInAServer( - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void firewallRuleList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.firewallRules().listByServer("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedPerformanceTierListSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedPerformanceTierListSamples.java new file mode 100644 index 0000000000000..93bd01e2c006c --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedPerformanceTierListSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for LocationBasedPerformanceTier List. */ +public final class LocationBasedPerformanceTierListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/PerformanceTiersListByLocation.json + */ + /** + * Sample code: PerformanceTiersList. + * + * @param manager Entry point to MySqlManager. + */ + public static void performanceTiersList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.locationBasedPerformanceTiers().list("WestUS", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedRecommendedActionSessionsOperationStatusGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedRecommendedActionSessionsOperationStatusGetSamples.java new file mode 100644 index 0000000000000..faca16bc14520 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedRecommendedActionSessionsOperationStatusGetSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for LocationBasedRecommendedActionSessionsOperationStatus Get. */ +public final class LocationBasedRecommendedActionSessionsOperationStatusGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionOperationStatus.json + */ + /** + * Sample code: RecommendedActionSessionOperationStatus. + * + * @param manager Entry point to MySqlManager. + */ + public static void recommendedActionSessionOperationStatus( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .locationBasedRecommendedActionSessionsOperationStatus() + .getWithResponse("WestUS", "aaaabbbb-cccc-dddd-0000-111122223333", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedRecommendedActionSessionsResultListSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedRecommendedActionSessionsResultListSamples.java new file mode 100644 index 0000000000000..c3358625a35a8 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LocationBasedRecommendedActionSessionsResultListSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for LocationBasedRecommendedActionSessionsResult List. */ +public final class LocationBasedRecommendedActionSessionsResultListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionResult.json + */ + /** + * Sample code: RecommendedActionSessionResult. + * + * @param manager Entry point to MySqlManager. + */ + public static void recommendedActionSessionResult( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .locationBasedRecommendedActionSessionsResults() + .list("WestUS", "aaaabbbb-cccc-dddd-0000-111122223333", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LogFilesListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LogFilesListByServerSamples.java new file mode 100644 index 0000000000000..88d4c15e06631 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/LogFilesListByServerSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for LogFiles ListByServer. */ +public final class LogFilesListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/LogFileListByServer.json + */ + /** + * Sample code: LogFileList. + * + * @param manager Entry point to MySqlManager. + */ + public static void logFileList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.logFiles().listByServer("TestGroup", "testserver", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/OperationsListSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/OperationsListSamples.java index d12ab2f05e052..9ca81e0d01fac 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/OperationsListSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/OperationsListSamples.java @@ -9,7 +9,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/OperationsList.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/OperationList.json */ /** * Sample code: OperationList. @@ -17,6 +17,6 @@ public final class OperationsListSamples { * @param manager Entry point to MySqlManager. */ public static void operationList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.operations().list(Context.NONE); + manager.operations().listWithResponse(Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9a68bcd17b933 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to MySqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServer("Default", "test-svr") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..a7265ddfc41e5 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsDeleteSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to MySqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .privateEndpointConnections() + .delete("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..8d7dc7e970cb8 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsGetSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to MySqlManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsListByServerSamples.java new file mode 100644 index 0000000000000..d891a220e7c1e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsListByServerSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByServer. */ +public final class PrivateEndpointConnectionsListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to MySqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsUpdateTagsSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsUpdateTagsSamples.java new file mode 100644 index 0000000000000..bd0f532c45055 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateEndpointConnectionsUpdateTagsSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.PrivateEndpointConnection; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateEndpointConnections UpdateTags. */ +public final class PrivateEndpointConnectionsUpdateTagsSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json + */ + /** + * Sample code: Update private endpoint connection Tags. + * + * @param manager Entry point to MySqlManager. + */ + public static void updatePrivateEndpointConnectionTags( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + PrivateEndpointConnection resource = + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "val1", "key2", "val2")).apply(); + } + + @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateLinkResourcesGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..2a04c12abb602 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateLinkResourcesGetSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for MySQL. + * + * @param manager Entry point to MySqlManager. + */ + public static void getsAPrivateLinkResourceForMySQL( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateLinkResourcesListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateLinkResourcesListByServerSamples.java new file mode 100644 index 0000000000000..bc9082fdce83a --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/PrivateLinkResourcesListByServerSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByServer. */ +public final class PrivateLinkResourcesListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for MySQL. + * + * @param manager Entry point to MySqlManager. + */ + public static void getsPrivateLinkResourcesForMySQL( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/QueryTextsGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/QueryTextsGetSamples.java new file mode 100644 index 0000000000000..434257536a952 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/QueryTextsGetSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for QueryTexts Get. */ +public final class QueryTextsGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsGet.json + */ + /** + * Sample code: QueryTextsGet. + * + * @param manager Entry point to MySqlManager. + */ + public static void queryTextsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.queryTexts().getWithResponse("testResourceGroupName", "testServerName", "1", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/QueryTextsListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/QueryTextsListByServerSamples.java new file mode 100644 index 0000000000000..94032408656d2 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/QueryTextsListByServerSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for QueryTexts ListByServer. */ +public final class QueryTextsListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsListByServer.json + */ + /** + * Sample code: QueryTextsListByServer. + * + * @param manager Entry point to MySqlManager. + */ + public static void queryTextsListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .queryTexts() + .listByServer("testResourceGroupName", "testServerName", Arrays.asList("1", "2"), Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/BackupsListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/RecommendedActionsGetSamples.java similarity index 52% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/BackupsListByServerSamples.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/RecommendedActionsGetSamples.java index 735f5c37c04b0..38d4afefb1aa5 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/BackupsListByServerSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/RecommendedActionsGetSamples.java @@ -6,17 +6,19 @@ import com.azure.core.util.Context; -/** Samples for Backups ListByServer. */ -public final class BackupsListByServerSamples { +/** Samples for RecommendedActions Get. */ +public final class RecommendedActionsGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/BackupsListByServer.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionsGet.json */ /** - * Sample code: List backups for a server. + * Sample code: RecommendedActionsGet. * * @param manager Entry point to MySqlManager. */ - public static void listBackupsForAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.backups().listByServer("TestGroup", "mysqltestserver", Context.NONE); + public static void recommendedActionsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .recommendedActions() + .getWithResponse("testResourceGroupName", "testServerName", "Index", "Index-1", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/RecommendedActionsListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/RecommendedActionsListByServerSamples.java new file mode 100644 index 0000000000000..d473062344255 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/RecommendedActionsListByServerSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for RecommendedActions ListByServer. */ +public final class RecommendedActionsListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionsListByServer.json + */ + /** + * Sample code: RecommendedActionsListByServer. + * + * @param manager Entry point to MySqlManager. + */ + public static void recommendedActionsListByServer( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .recommendedActions() + .listByServer("testResourceGroupName", "testServerName", "Index", null, Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/BackupsGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/RecoverableServersGetSamples.java similarity index 56% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/BackupsGetSamples.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/RecoverableServersGetSamples.java index c24f50f1ce485..107a470a6287b 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/BackupsGetSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/RecoverableServersGetSamples.java @@ -6,17 +6,17 @@ import com.azure.core.util.Context; -/** Samples for Backups Get. */ -public final class BackupsGetSamples { +/** Samples for RecoverableServers Get. */ +public final class RecoverableServersGetSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/BackupGet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/RecoverableServersGet.json */ /** - * Sample code: Get a backup for a server. + * Sample code: ReplicasListByServer. * * @param manager Entry point to MySqlManager. */ - public static void getABackupForAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.backups().getWithResponse("TestGroup", "mysqltestserver", "daily_20210615T160516", Context.NONE); + public static void replicasListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.recoverableServers().getWithResponse("testrg", "testsvc4", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ReplicasListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ReplicasListByServerSamples.java index 8f222ee89ef1c..198fc46edf96d 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ReplicasListByServerSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ReplicasListByServerSamples.java @@ -9,14 +9,14 @@ /** Samples for Replicas ListByServer. */ public final class ReplicasListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ReplicasListByServer.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json */ /** - * Sample code: List replicas for a server. + * Sample code: ReplicasListByServer. * * @param manager Entry point to MySqlManager. */ - public static void listReplicasForAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.replicas().listByServer("TestGroup", "mysqltestserver", Context.NONE); + public static void replicasListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.replicas().listByServer("TestGroup", "testmaster", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ResourceProviderCreateRecommendedActionSessionSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ResourceProviderCreateRecommendedActionSessionSamples.java new file mode 100644 index 0000000000000..935935a42a974 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ResourceProviderCreateRecommendedActionSessionSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceProvider CreateRecommendedActionSession. */ +public final class ResourceProviderCreateRecommendedActionSessionSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionCreate.json + */ + /** + * Sample code: RecommendedActionSessionCreate. + * + * @param manager Entry point to MySqlManager. + */ + public static void recommendedActionSessionCreate( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .resourceProviders() + .createRecommendedActionSession( + "testResourceGroupName", "testServerName", "Index", "someDatabaseName", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ResourceProviderResetQueryPerformanceInsightDataSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ResourceProviderResetQueryPerformanceInsightDataSamples.java new file mode 100644 index 0000000000000..22b3aa8660eb3 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ResourceProviderResetQueryPerformanceInsightDataSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceProvider ResetQueryPerformanceInsightData. */ +public final class ResourceProviderResetQueryPerformanceInsightDataSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryPerformanceInsightResetData.json + */ + /** + * Sample code: QueryPerformanceInsightResetData. + * + * @param manager Entry point to MySqlManager. + */ + public static void queryPerformanceInsightResetData( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .resourceProviders() + .resetQueryPerformanceInsightDataWithResponse("testResourceGroupName", "testServerName", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsCreateOrUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..44e53566244ad --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsCreateOrUpdateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.mysqlflexibleserver.models.AdministratorType; +import java.util.UUID; + +/** Samples for ServerAdministrators CreateOrUpdate. */ +public final class ServerAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json + */ + /** + * Sample code: ServerAdministratorCreate. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverAdministratorCreate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverAdministrators() + .createOrUpdate( + "testrg", + "mysqltestsvc4", + new ServerAdministratorResourceInner() + .withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .withTenantId(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")), + Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsDeleteSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsDeleteSamples.java new file mode 100644 index 0000000000000..2065f161ab5a8 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsDeleteSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdministrators Delete. */ +public final class ServerAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminDelete.json + */ + /** + * Sample code: ServerAdministratorsDelete. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverAdministratorsDelete(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverAdministrators().delete("testrg", "mysqltestsvc4", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsGetSamples.java new file mode 100644 index 0000000000000..b70de03eb5059 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsGetSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdministrators Get. */ +public final class ServerAdministratorsGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminGet.json + */ + /** + * Sample code: ServerAdministratorGet. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverAdministratorGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverAdministrators().getWithResponse("testrg", "mysqltestsvc4", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsListSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsListSamples.java new file mode 100644 index 0000000000000..69877e1bf2325 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerAdministratorsListSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdministrators List. */ +public final class ServerAdministratorsListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminList.json + */ + /** + * Sample code: get a list of server administrators. + * + * @param manager Entry point to MySqlManager. + */ + public static void getAListOfServerAdministrators( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverAdministrators().list("testrg", "mysqltestsvc4", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerBasedPerformanceTierListSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerBasedPerformanceTierListSamples.java new file mode 100644 index 0000000000000..bab2c82070528 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerBasedPerformanceTierListSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerBasedPerformanceTier List. */ +public final class ServerBasedPerformanceTierListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json + */ + /** + * Sample code: PerformanceTiersList. + * + * @param manager Entry point to MySqlManager. + */ + public static void performanceTiersList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverBasedPerformanceTiers().list("testrg", "mysqltestsvc1", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysCreateOrUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..7693fa1b7940e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysCreateOrUpdateSamples.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.mysqlflexibleserver.generated; + +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerKeyType; + +/** Samples for ServerKeys CreateOrUpdate. */ +public final class ServerKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a MySQL Server key. + * + * @param manager Entry point to MySqlManager. + */ + public static void createsOrUpdatesAMySQLServerKey( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingServer("testserver", "testrg") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersFailoverSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysDeleteSamples.java similarity index 52% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersFailoverSamples.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysDeleteSamples.java index 135e532c33860..eb2e95073d34e 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersFailoverSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysDeleteSamples.java @@ -6,17 +6,19 @@ import com.azure.core.util.Context; -/** Samples for Servers Failover. */ -public final class ServersFailoverSamples { +/** Samples for ServerKeys Delete. */ +public final class ServerKeysDeleteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerFailover.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyDelete.json */ /** - * Sample code: Restart a server. + * Sample code: Delete the MySQL Server key. * * @param manager Entry point to MySqlManager. */ - public static void restartAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().failover("TestGroup", "testserver", Context.NONE); + public static void deleteTheMySQLServerKey(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverKeys() + .delete("testserver", "someVault_someKey_01234567890123456789012345678901", "testrg", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysGetSamples.java new file mode 100644 index 0000000000000..43cc2ee06db6a --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysGetSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys Get. */ +public final class ServerKeysGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyGet.json + */ + /** + * Sample code: Get the MySQL Server key. + * + * @param manager Entry point to MySqlManager. + */ + public static void getTheMySQLServerKey(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverKeys() + .getWithResponse( + "testrg", "testserver", "someVault_someKey_01234567890123456789012345678901", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysListSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysListSamples.java new file mode 100644 index 0000000000000..f76c2d971d560 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerKeysListSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys List. */ +public final class ServerKeysListSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyList.json + */ + /** + * Sample code: List the keys for a MySQL Server. + * + * @param manager Entry point to MySqlManager. + */ + public static void listTheKeysForAMySQLServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverKeys().list("testrg", "testserver", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerParametersListUpdateConfigurationsSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerParametersListUpdateConfigurationsSamples.java new file mode 100644 index 0000000000000..a3255f5bbdaad --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerParametersListUpdateConfigurationsSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ConfigurationListResultInner; + +/** Samples for ServerParameters ListUpdateConfigurations. */ +public final class ServerParametersListUpdateConfigurationsSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json + */ + /** + * Sample code: ConfigurationList. + * + * @param manager Entry point to MySqlManager. + */ + public static void configurationList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverParameters() + .listUpdateConfigurations("testrg", "mysqltestsvc1", new ConfigurationListResultInner(), Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..488ed7813457e --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicy; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerSecurityAlertPolicyState; +import java.util.Arrays; + +/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json + */ + /** + * Sample code: Update a server's threat detection policy with minimal parameters. + * + * @param manager Entry point to MySqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(ServerSecurityAlertPolicyState.DISABLED).withEmailAccountAdmins(true).apply(); + } + + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json + */ + /** + * Sample code: Update a server's threat detection policy with all parameters. + * + * @param manager Entry point to MySqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(ServerSecurityAlertPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerSecurityAlertPoliciesGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerSecurityAlertPoliciesGetSamples.java new file mode 100644 index 0000000000000..c2ba53e8c3109 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerSecurityAlertPoliciesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.SecurityAlertPolicyName; + +/** Samples for ServerSecurityAlertPolicies Get. */ +public final class ServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json + */ + /** + * Sample code: Get a server's threat detection policy. + * + * @param manager Entry point to MySqlManager. + */ + public static void getAServerSThreatDetectionPolicy( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerSecurityAlertPoliciesListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerSecurityAlertPoliciesListByServerSamples.java new file mode 100644 index 0000000000000..73155070cc662 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServerSecurityAlertPoliciesListByServerSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerSecurityAlertPolicies ListByServer. */ +public final class ServerSecurityAlertPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json + */ + /** + * Sample code: List the server's threat detection policies. + * + * @param manager Entry point to MySqlManager. + */ + public static void listTheServerSThreatDetectionPolicies( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersCreateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersCreateSamples.java index 9c0b56994d44c..23357333bafb7 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersCreateSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersCreateSamples.java @@ -4,22 +4,15 @@ package com.azure.resourcemanager.mysqlflexibleserver.generated; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.mysqlflexibleserver.models.Backup; -import com.azure.resourcemanager.mysqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryption; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryptionType; -import com.azure.resourcemanager.mysqlflexibleserver.models.EnableStatusEnum; -import com.azure.resourcemanager.mysqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.mysqlflexibleserver.models.HighAvailabilityMode; -import com.azure.resourcemanager.mysqlflexibleserver.models.Identity; -import com.azure.resourcemanager.mysqlflexibleserver.models.ManagedServiceIdentityType; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.mysqlflexibleserver.models.GeoRedundantBackup; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPropertiesForDefaultCreate; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPropertiesForGeoRestore; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPropertiesForReplica; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerPropertiesForRestore; import com.azure.resourcemanager.mysqlflexibleserver.models.Sku; import com.azure.resourcemanager.mysqlflexibleserver.models.SkuTier; -import com.azure.resourcemanager.mysqlflexibleserver.models.Storage; -import java.io.IOException; +import com.azure.resourcemanager.mysqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.mysqlflexibleserver.models.StorageProfile; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; @@ -27,7 +20,7 @@ /** Samples for Servers Create. */ public final class ServersCreateSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreateReplica.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json */ /** * Sample code: Create a replica server. @@ -37,111 +30,93 @@ public final class ServersCreateSamples { public static void createAReplicaServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .servers() - .define("replica-server") - .withRegion("SoutheastAsia") - .withExistingResourceGroup("testgr") - .withCreateMode(CreateMode.REPLICA) - .withSourceServerResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testgr/providers/Microsoft.DBforMySQL/flexibleServers/source-server") + .define("targetserver") + .withRegion("westus") + .withExistingResourceGroup("TargetResourceGroup") + .withProperties( + new ServerPropertiesForReplica() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver")) .create(); } /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreate.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json */ /** - * Sample code: Create a new server. + * Sample code: Create a server as a geo restore. * * @param manager Entry point to MySqlManager. */ - public static void createANewServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void createAServerAsAGeoRestore(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .servers() - .define("mysqltestserver") - .withRegion("southeastasia") - .withExistingResourceGroup("testrg") - .withTags(mapOf("num", "1")) - .withSku(new Sku().withName("Standard_D2ds_v4").withTier(SkuTier.GENERAL_PURPOSE)) - .withAdministratorLogin("cloudsa") - .withAdministratorLoginPassword("your_password") - .withVersion(ServerVersion.FIVE_SEVEN) - .withAvailabilityZone("1") - .withCreateMode(CreateMode.DEFAULT) - .withStorage(new Storage().withStorageSizeGB(100).withIops(600).withAutoGrow(EnableStatusEnum.DISABLED)) - .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(EnableStatusEnum.DISABLED)) - .withHighAvailability( - new HighAvailability().withMode(HighAvailabilityMode.ZONE_REDUNDANT).withStandbyAvailabilityZone("3")) + .define("targetserver") + .withRegion("westus") + .withExistingResourceGroup("TargetResourceGroup") + .withProperties( + new ServerPropertiesForGeoRestore() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver")) + .withTags(mapOf("ElasticServer", "1")) + .withSku( + new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) .create(); } /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreateWithBYOK.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreate.json */ /** - * Sample code: Create a server with byok. + * Sample code: Create a new server. * * @param manager Entry point to MySqlManager. */ - public static void createAServerWithByok(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) - throws IOException { + public static void createANewServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .servers() - .define("mysqltestserver") - .withRegion("southeastasia") + .define("mysqltestsvc4") + .withRegion("westus") .withExistingResourceGroup("testrg") - .withTags(mapOf("num", "1")) - .withIdentity( - new Identity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity", - SerializerFactory - .createDefaultManagementSerializerAdapter() - .deserialize("{}", Object.class, SerializerEncoding.JSON)))) - .withSku(new Sku().withName("Standard_D2ds_v4").withTier(SkuTier.GENERAL_PURPOSE)) - .withAdministratorLogin("cloudsa") - .withAdministratorLoginPassword("your_password") - .withVersion(ServerVersion.FIVE_SEVEN) - .withAvailabilityZone("1") - .withCreateMode(CreateMode.DEFAULT) - .withDataEncryption( - new DataEncryption() - .withPrimaryUserAssignedIdentityId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity") - .withPrimaryKeyUri("https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a") - .withGeoBackupUserAssignedIdentityId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity") - .withGeoBackupKeyUri("https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a") - .withType(DataEncryptionType.AZURE_KEY_VAULT)) - .withStorage(new Storage().withStorageSizeGB(100).withIops(600).withAutoGrow(EnableStatusEnum.DISABLED)) - .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(EnableStatusEnum.DISABLED)) - .withHighAvailability( - new HighAvailability().withMode(HighAvailabilityMode.ZONE_REDUNDANT).withStandbyAvailabilityZone("3")) + .withProperties( + new ServerPropertiesForDefaultCreate() + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withStorageProfile( + new StorageProfile() + .withBackupRetentionDays(7) + .withGeoRedundantBackup(GeoRedundantBackup.ENABLED) + .withStorageMB(128000)) + .withAdministratorLogin("cloudsa") + .withAdministratorLoginPassword("")) + .withTags(mapOf("ElasticServer", "1")) + .withSku( + new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) .create(); } /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerCreateWithPointInTimeRestore.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json */ /** - * Sample code: Create a server as a point in time restore. + * Sample code: Create a database as a point in time restore. * * @param manager Entry point to MySqlManager. */ - public static void createAServerAsAPointInTimeRestore( + public static void createADatabaseAsAPointInTimeRestore( com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager .servers() .define("targetserver") - .withRegion("SoutheastAsia") + .withRegion("brazilsouth") .withExistingResourceGroup("TargetResourceGroup") - .withTags(mapOf("num", "1")) - .withSku(new Sku().withName("Standard_D14_v2").withTier(SkuTier.GENERAL_PURPOSE)) - .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) - .withSourceServerResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/flexibleServers/sourceserver") - .withRestorePointInTime(OffsetDateTime.parse("2021-06-24T00:00:37.467Z")) + .withProperties( + new ServerPropertiesForRestore() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver") + .withRestorePointInTime(OffsetDateTime.parse("2017-12-14T00:00:37.467Z"))) + .withTags(mapOf("ElasticServer", "1")) + .withSku( + new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) .create(); } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersDeleteSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersDeleteSamples.java index ea69130f39ef7..d412c95694166 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersDeleteSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersDeleteSamples.java @@ -9,14 +9,14 @@ /** Samples for Servers Delete. */ public final class ServersDeleteSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerDelete.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerDelete.json */ /** - * Sample code: Delete a server. + * Sample code: ServerDelete. * * @param manager Entry point to MySqlManager. */ - public static void deleteAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void serverDelete(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.servers().delete("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersGetByResourceGroupSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersGetByResourceGroupSamples.java index 4129726b58de2..9600972ed930a 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersGetByResourceGroupSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersGetByResourceGroupSamples.java @@ -9,26 +9,14 @@ /** Samples for Servers GetByResourceGroup. */ public final class ServersGetByResourceGroupSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerGetWithVnet.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json */ /** - * Sample code: Get a server with vnet. + * Sample code: ServerGet. * * @param manager Entry point to MySqlManager. */ - public static void getAServerWithVnet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE); - } - - /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerGet.json - */ - /** - * Sample code: Get a server. - * - * @param manager Entry point to MySqlManager. - */ - public static void getAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE); + public static void serverGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestsvc4", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersListByResourceGroupSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersListByResourceGroupSamples.java index efa6cfbe3b72d..53fe25c5499e1 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersListByResourceGroupSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersListByResourceGroupSamples.java @@ -9,14 +9,14 @@ /** Samples for Servers ListByResourceGroup. */ public final class ServersListByResourceGroupSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServersListByResourceGroup.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerListByResourceGroup.json */ /** - * Sample code: List servers in a resource group. + * Sample code: ServerListByResourceGroup. * * @param manager Entry point to MySqlManager. */ - public static void listServersInAResourceGroup(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.servers().listByResourceGroup("TestGroup", Context.NONE); + public static void serverListByResourceGroup(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().listByResourceGroup("testrg", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersListSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersListSamples.java index c6f04e4c96133..2c7240f2332e0 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersListSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersListSamples.java @@ -9,14 +9,14 @@ /** Samples for Servers List. */ public final class ServersListSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServersList.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerList.json */ /** - * Sample code: List servers in a subscription. + * Sample code: ServerList. * * @param manager Entry point to MySqlManager. */ - public static void listServersInASubscription(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void serverList(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.servers().list(Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersRestartSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersRestartSamples.java index c11bd74d4cafb..b1685a224473e 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersRestartSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersRestartSamples.java @@ -5,28 +5,18 @@ package com.azure.resourcemanager.mysqlflexibleserver.generated; import com.azure.core.util.Context; -import com.azure.resourcemanager.mysqlflexibleserver.models.EnableStatusEnum; -import com.azure.resourcemanager.mysqlflexibleserver.models.ServerRestartParameter; /** Samples for Servers Restart. */ public final class ServersRestartSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerRestart.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerRestart.json */ /** - * Sample code: Restart a server. + * Sample code: ServerRestart. * * @param manager Entry point to MySqlManager. */ - public static void restartAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager - .servers() - .restart( - "TestGroup", - "testserver", - new ServerRestartParameter() - .withRestartWithFailover(EnableStatusEnum.ENABLED) - .withMaxFailoverSeconds(60), - Context.NONE); + public static void serverRestart(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.servers().restart("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersStartSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersStartSamples.java index 35e8be547fa57..f22750efd1d02 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersStartSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersStartSamples.java @@ -9,14 +9,14 @@ /** Samples for Servers Start. */ public final class ServersStartSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerStart.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerStart.json */ /** - * Sample code: Start a server. + * Sample code: ServerStart. * * @param manager Entry point to MySqlManager. */ - public static void startAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void serverStart(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.servers().start("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersStopSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersStopSamples.java index 405d28971304c..5bf4e0803d297 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersStopSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersStopSamples.java @@ -9,14 +9,14 @@ /** Samples for Servers Stop. */ public final class ServersStopSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerStop.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerStop.json */ /** - * Sample code: Stop a server. + * Sample code: ServerStop. * * @param manager Entry point to MySqlManager. */ - public static void stopAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void serverStop(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { manager.servers().stop("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersUpdateSamples.java index e878d2dcc92c9..685aab2120ef7 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersUpdateSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersUpdateSamples.java @@ -4,106 +4,27 @@ package com.azure.resourcemanager.mysqlflexibleserver.generated; -import com.azure.core.management.serializer.SerializerFactory; import com.azure.core.util.Context; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryption; -import com.azure.resourcemanager.mysqlflexibleserver.models.DataEncryptionType; -import com.azure.resourcemanager.mysqlflexibleserver.models.EnableStatusEnum; -import com.azure.resourcemanager.mysqlflexibleserver.models.Identity; -import com.azure.resourcemanager.mysqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.mysqlflexibleserver.models.ManagedServiceIdentityType; import com.azure.resourcemanager.mysqlflexibleserver.models.Server; -import com.azure.resourcemanager.mysqlflexibleserver.models.Storage; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; +import com.azure.resourcemanager.mysqlflexibleserver.models.SslEnforcementEnum; /** Samples for Servers Update. */ public final class ServersUpdateSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerUpdateWithCustomerMaintenanceWindow.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerUpdate.json */ /** - * Sample code: Update server customer maintenance window. + * Sample code: ServerUpdate. * * @param manager Entry point to MySqlManager. */ - public static void updateServerCustomerMaintenanceWindow( - com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + public static void serverUpdate(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { Server resource = - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE).getValue(); + manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestsvc4", Context.NONE).getValue(); resource .update() - .withMaintenanceWindow( - new MaintenanceWindow() - .withCustomWindow("Enabled") - .withStartHour(8) - .withStartMinute(0) - .withDayOfWeek(1)) + .withAdministratorLoginPassword("") + .withSslEnforcement(SslEnforcementEnum.DISABLED) .apply(); } - - /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerUpdateWithBYOK.json - */ - /** - * Sample code: Update server with byok. - * - * @param manager Entry point to MySqlManager. - */ - public static void updateServerWithByok(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) - throws IOException { - Server resource = - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE).getValue(); - resource - .update() - .withIdentity( - new Identity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity", - SerializerFactory - .createDefaultManagementSerializerAdapter() - .deserialize("{}", Object.class, SerializerEncoding.JSON)))) - .withDataEncryption( - new DataEncryption() - .withPrimaryUserAssignedIdentityId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity") - .withPrimaryKeyUri("https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a") - .withGeoBackupUserAssignedIdentityId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity") - .withGeoBackupKeyUri("https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a") - .withType(DataEncryptionType.AZURE_KEY_VAULT)) - .apply(); - } - - /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/ServerUpdate.json - */ - /** - * Sample code: Update a server. - * - * @param manager Entry point to MySqlManager. - */ - public static void updateAServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - Server resource = - manager.servers().getByResourceGroupWithResponse("testrg", "mysqltestserver", Context.NONE).getValue(); - resource - .update() - .withStorage(new Storage().withStorageSizeGB(30).withIops(200).withAutoGrow(EnableStatusEnum.DISABLED)) - .apply(); - } - - @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/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersUpgradeSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersUpgradeSamples.java new file mode 100644 index 0000000000000..7fbc313d75a4f --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/ServersUpgradeSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.ServerUpgradeParameters; + +/** Samples for Servers Upgrade. */ +public final class ServersUpgradeSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerUpgrade.json + */ + /** + * Sample code: ServerUpgrade. + * + * @param manager Entry point to MySqlManager. + */ + public static void serverUpgrade(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .servers() + .upgrade( + "TestGroup", "testserver", new ServerUpgradeParameters().withTargetServerVersion("5.7"), Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/TopQueryStatisticsGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/TopQueryStatisticsGetSamples.java new file mode 100644 index 0000000000000..86677433245b9 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/TopQueryStatisticsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for TopQueryStatistics Get. */ +public final class TopQueryStatisticsGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/TopQueryStatisticsGet.json + */ + /** + * Sample code: TopQueryStatisticsGet. + * + * @param manager Entry point to MySqlManager. + */ + public static void topQueryStatisticsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .topQueryStatistics() + .getWithResponse( + "testResourceGroupName", + "testServerName", + "66-636923268000000000-636923277000000000-avg-duration", + Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/TopQueryStatisticsListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/TopQueryStatisticsListByServerSamples.java new file mode 100644 index 0000000000000..abb2a65ec0421 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/TopQueryStatisticsListByServerSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.TopQueryStatisticsInput; +import java.time.OffsetDateTime; + +/** Samples for TopQueryStatistics ListByServer. */ +public final class TopQueryStatisticsListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/TopQueryStatisticsListByServer.json + */ + /** + * Sample code: TopQueryStatisticsListByServer. + * + * @param manager Entry point to MySqlManager. + */ + public static void topQueryStatisticsListByServer( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .topQueryStatistics() + .listByServer( + "testResourceGroupName", + "testServerName", + new TopQueryStatisticsInput() + .withNumberOfTopQueries(5) + .withAggregationFunction("avg") + .withObservedMetric("duration") + .withObservationStartTime(OffsetDateTime.parse("2019-05-01T20:00:00.000Z")) + .withObservationEndTime(OffsetDateTime.parse("2019-05-07T20:00:00.000Z")) + .withAggregationWindow("PT15M"), + Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesCreateOrUpdateSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b9122c29dd2ad --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +/** Samples for VirtualNetworkRules CreateOrUpdate. */ +public final class VirtualNetworkRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json + */ + /** + * Sample code: Create or update a virtual network rule. + * + * @param manager Entry point to MySqlManager. + */ + public static void createOrUpdateAVirtualNetworkRule( + com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .virtualNetworkRules() + .define("vnet-firewall-rule") + .withExistingServer("TestGroup", "vnet-test-svr") + .withVirtualNetworkSubnetId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet") + .withIgnoreMissingVnetServiceEndpoint(false) + .create(); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesDeleteSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesDeleteSamples.java new file mode 100644 index 0000000000000..a0dd1d3aa85bc --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesDeleteSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Delete. */ +public final class VirtualNetworkRulesDeleteSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json + */ + /** + * Sample code: Delete a virtual network rule. + * + * @param manager Entry point to MySqlManager. + */ + public static void deleteAVirtualNetworkRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.virtualNetworkRules().delete("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesGetSamples.java new file mode 100644 index 0000000000000..969ac0ef3af25 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesGetSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Get. */ +public final class VirtualNetworkRulesGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json + */ + /** + * Sample code: Gets a virtual network rule. + * + * @param manager Entry point to MySqlManager. + */ + public static void getsAVirtualNetworkRule(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.virtualNetworkRules().getWithResponse("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesListByServerSamples.java similarity index 54% rename from sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java rename to sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesListByServerSamples.java index 64247ccede540..c470cd96f11e5 100644 --- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/VirtualNetworkRulesListByServerSamples.java @@ -6,17 +6,17 @@ import com.azure.core.util.Context; -/** Samples for GetPrivateDnsZoneSuffix Execute. */ -public final class GetPrivateDnsZoneSuffixExecuteSamples { +/** Samples for VirtualNetworkRules ListByServer. */ +public final class VirtualNetworkRulesListByServerSamples { /* - * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/examples/GetPrivateDnsZoneSuffix.json + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json */ /** - * Sample code: GetPrivateDnsZoneSuffix. + * Sample code: List virtual network rules. * * @param manager Entry point to MySqlManager. */ - public static void getPrivateDnsZoneSuffix(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { - manager.getPrivateDnsZoneSuffixes().executeWithResponse(Context.NONE); + public static void listVirtualNetworkRules(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager.virtualNetworkRules().listByServer("TestGroup", "vnet-test-svr", Context.NONE); } } diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/WaitStatisticsGetSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/WaitStatisticsGetSamples.java new file mode 100644 index 0000000000000..694b7b34c0e10 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/WaitStatisticsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for WaitStatistics Get. */ +public final class WaitStatisticsGetSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/WaitStatisticsGet.json + */ + /** + * Sample code: WaitStatisticsGet. + * + * @param manager Entry point to MySqlManager. + */ + public static void waitStatisticsGet(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .waitStatistics() + .getWithResponse( + "testResourceGroupName", + "testServerName", + "636927606000000000-636927615000000000-send-wait/io/socket/sql/client_connection-2--0", + Context.NONE); + } +} diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/WaitStatisticsListByServerSamples.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/WaitStatisticsListByServerSamples.java new file mode 100644 index 0000000000000..5d03675de7519 --- /dev/null +++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/samples/java/com/azure/resourcemanager/mysqlflexibleserver/generated/WaitStatisticsListByServerSamples.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.mysqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mysqlflexibleserver.models.WaitStatisticsInput; +import java.time.OffsetDateTime; + +/** Samples for WaitStatistics ListByServer. */ +public final class WaitStatisticsListByServerSamples { + /* + * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/WaitStatisticsListByServer.json + */ + /** + * Sample code: WaitStatisticsListByServer. + * + * @param manager Entry point to MySqlManager. + */ + public static void waitStatisticsListByServer(com.azure.resourcemanager.mysqlflexibleserver.MySqlManager manager) { + manager + .waitStatistics() + .listByServer( + "testResourceGroupName", + "testServerName", + new WaitStatisticsInput() + .withObservationStartTime(OffsetDateTime.parse("2019-05-01T20:00:00.000Z")) + .withObservationEndTime(OffsetDateTime.parse("2019-05-07T20:00:00.000Z")) + .withAggregationWindow("PT15M"), + Context.NONE); + } +}