diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md index 668be3d0fe31..352316422e6b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.5 (Unreleased) +## 1.0.0-beta.1 (2022-12-15) + +- Azure Resource Manager PostgreSql client library for Java. This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md index 3d7b24a3946a..89a058e5e016 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md @@ -2,7 +2,7 @@ Azure Resource Manager PostgreSql client library for Java. -This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2021-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-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-postgresqlflexibleserver - 1.0.0-beta.4 + 1.0.0-beta.5 ``` [//]: # ({x-version-update-end}) @@ -41,19 +41,19 @@ Various documentation is available to help you get started Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. -[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. ### Authentication -By default, Azure Active Directory token authentication depends on correct configure of following environment variables. +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. - `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. -In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -With above configuration, `azure` client can be authenticated by following code: +With above configuration, `azure` client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -83,13 +83,13 @@ See [API design][design] for general introduction on design and key concepts on ## Contributing -For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). +For details on contributing to this repository, see the [contributing guide][cg]. -1. Fork it -1. Create your feature branch (`git checkout -b my-new-feature`) -1. Commit your changes (`git commit -am 'Add some feature'`) -1. Push to the branch (`git push origin my-new-feature`) -1. Create new Pull Request +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. [survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS @@ -100,3 +100,6 @@ For details on contributing to this repository, see the [contributing guide](htt [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty [authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md [design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/SAMPLE.md b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/SAMPLE.md index 367b59dc0563..422e46fed07f 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/SAMPLE.md +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/SAMPLE.md @@ -7,14 +7,13 @@ ## Configurations +- [CreateOrUpdate](#configurations_createorupdate) - [Get](#configurations_get) - [ListByServer](#configurations_listbyserver) -- [Put](#configurations_put) -- [Update](#configurations_update) ## Databases -- [Create](#databases_create) +- [CreateOrUpdate](#databases_createorupdate) - [Delete](#databases_delete) - [Get](#databases_get) - [ListByServer](#databases_listbyserver) @@ -26,18 +25,67 @@ - [Get](#firewallrules_get) - [ListByServer](#firewallrules_listbyserver) -## GetPrivateDnsZoneSuffix +## LocationBasedPerformanceTier -- [Execute](#getprivatednszonesuffix_execute) +- [List](#locationbasedperformancetier_list) -## LocationBasedCapabilities +## LogFiles -- [Execute](#locationbasedcapabilities_execute) +- [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) + +## RecoverableServers + +- [Get](#recoverableservers_get) + +## Replicas + +- [ListByServer](#replicas_listbyserver) + +## 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) @@ -46,13 +94,14 @@ - [List](#servers_list) - [ListByResourceGroup](#servers_listbyresourcegroup) - [Restart](#servers_restart) -- [Start](#servers_start) -- [Stop](#servers_stop) - [Update](#servers_update) -## VirtualNetworkSubnetUsage +## VirtualNetworkRules -- [Execute](#virtualnetworksubnetusage_execute) +- [CreateOrUpdate](#virtualnetworkrules_createorupdate) +- [Delete](#virtualnetworkrules_delete) +- [Get](#virtualnetworkrules_get) +- [ListByServer](#virtualnetworkrules_listbyserver) ### CheckNameAvailability_Execute ```java @@ -62,7 +111,7 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.NameAvailabilit /** Samples for CheckNameAvailability Execute. */ public final class CheckNameAvailabilityExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/CheckNameAvailability.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/CheckNameAvailability.json */ /** * Sample code: NameAvailability. @@ -73,128 +122,99 @@ public final class CheckNameAvailabilityExecuteSamples { manager .checkNameAvailabilities() .executeWithResponse( - new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforPostgreSQL/flexibleServers"), - Context.NONE); + new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforPostgreSQL"), Context.NONE); } } ``` -### Configurations_Get +### Configurations_CreateOrUpdate ```java -import com.azure.core.util.Context; - -/** Samples for Configurations Get. */ -public final class ConfigurationsGetSamples { +/** Samples for Configurations CreateOrUpdate. */ +public final class ConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json */ /** - * Sample code: ConfigurationGet. + * Sample code: ConfigurationCreateOrUpdate. * * @param manager Entry point to PostgreSqlManager. */ - public static void configurationGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.configurations().getWithResponse("testrg", "testserver", "array_nulls", Context.NONE); + public static void configurationCreateOrUpdate( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .configurations() + .define("array_nulls") + .withExistingServer("TestGroup", "testserver") + .withValue("off") + .withSource("user-override") + .create(); } } ``` -### Configurations_ListByServer +### Configurations_Get ```java import com.azure.core.util.Context; -/** Samples for Configurations ListByServer. */ -public final class ConfigurationsListByServerSamples { - /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationListByServer.json - */ - /** - * Sample code: ConfigurationList. - * - * @param manager Entry point to PostgreSqlManager. - */ - public static void configurationList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.configurations().listByServer("testrg", "testserver", Context.NONE); - } -} -``` - -### Configurations_Put - -```java -/** Samples for Configurations Put. */ -public final class ConfigurationsPutSamples { +/** Samples for Configurations Get. */ +public final class ConfigurationsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json */ /** - * Sample code: Update a user configuration. + * Sample code: ConfigurationGet. * * @param manager Entry point to PostgreSqlManager. */ - public static void updateAUserConfiguration( - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager - .configurations() - .define("event_scheduler") - .withExistingFlexibleServer("testrg", "testserver") - .withValue("on") - .withSource("user-override") - .create(); + public static void configurationGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.configurations().getWithResponse("TestGroup", "testserver", "array_nulls", Context.NONE); } } ``` -### Configurations_Update +### Configurations_ListByServer ```java import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; -/** Samples for Configurations Update. */ -public final class ConfigurationsUpdateSamples { +/** Samples for Configurations ListByServer. */ +public final class ConfigurationsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationListByServer.json */ /** - * Sample code: Update a user configuration. + * Sample code: ConfigurationList. * * @param manager Entry point to PostgreSqlManager. */ - public static void updateAUserConfiguration( - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - Configuration resource = - manager - .configurations() - .getWithResponse("testrg", "testserver", "event_scheduler", Context.NONE) - .getValue(); - resource.update().withValue("on").withSource("user-override").apply(); + public static void configurationList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.configurations().listByServer("TestGroup", "testserver", Context.NONE); } } ``` -### Databases_Create +### Databases_CreateOrUpdate ```java -/** Samples for Databases Create. */ -public final class DatabasesCreateSamples { +/** Samples for Databases CreateOrUpdate. */ +public final class DatabasesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/DatabaseCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate.json */ /** - * Sample code: Create a database. + * Sample code: DatabaseCreate. * * @param manager Entry point to PostgreSqlManager. */ - public static void createADatabase(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + public static void databaseCreate(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager .databases() .define("db1") - .withExistingFlexibleServer("TestGroup", "testserver") - .withCharset("utf8") - .withCollation("en_US.utf8") + .withExistingServer("TestGroup", "testserver") + .withCharset("UTF8") + .withCollation("English_United States.1252") .create(); } } @@ -208,14 +228,14 @@ import com.azure.core.util.Context; /** Samples for Databases Delete. */ public final class DatabasesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/DatabaseDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseDelete.json */ /** - * Sample code: Delete a database. + * Sample code: DatabaseDelete. * * @param manager Entry point to PostgreSqlManager. */ - public static void deleteADatabase(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + public static void databaseDelete(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager.databases().delete("TestGroup", "testserver", "db1", Context.NONE); } } @@ -229,14 +249,14 @@ import com.azure.core.util.Context; /** Samples for Databases Get. */ public final class DatabasesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/DatabaseGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json */ /** - * Sample code: Get a database. + * Sample code: DatabaseGet. * * @param manager Entry point to PostgreSqlManager. */ - public static void getADatabase(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + public static void databaseGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager.databases().getWithResponse("TestGroup", "testserver", "db1", Context.NONE); } } @@ -250,15 +270,14 @@ import com.azure.core.util.Context; /** Samples for Databases ListByServer. */ public final class DatabasesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/DatabasesListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseListByServer.json */ /** - * Sample code: List databases in a server. + * Sample code: DatabaseList. * * @param manager Entry point to PostgreSqlManager. */ - public static void listDatabasesInAServer( - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + public static void databaseList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager.databases().listByServer("TestGroup", "testserver", Context.NONE); } } @@ -270,7 +289,7 @@ public final class DatabasesListByServerSamples { /** Samples for FirewallRules CreateOrUpdate. */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/FirewallRuleCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate.json */ /** * Sample code: FirewallRuleCreate. @@ -282,7 +301,7 @@ public final class FirewallRulesCreateOrUpdateSamples { manager .firewallRules() .define("rule1") - .withExistingFlexibleServer("testrg", "testserver") + .withExistingServer("TestGroup", "testserver") .withStartIpAddress("0.0.0.0") .withEndIpAddress("255.255.255.255") .create(); @@ -298,7 +317,7 @@ import com.azure.core.util.Context; /** Samples for FirewallRules Delete. */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/FirewallRuleDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleDelete.json */ /** * Sample code: FirewallRuleDelete. @@ -307,7 +326,7 @@ public final class FirewallRulesDeleteSamples { */ public static void firewallRuleDelete( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.firewallRules().delete("testrg", "testserver", "rule1", Context.NONE); + manager.firewallRules().delete("TestGroup", "testserver", "rule1", Context.NONE); } } ``` @@ -320,15 +339,15 @@ import com.azure.core.util.Context; /** Samples for FirewallRules Get. */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/FirewallRuleGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json */ /** - * Sample code: FirewallRuleList. + * Sample code: FirewallRuleGet. * * @param manager Entry point to PostgreSqlManager. */ - public static void firewallRuleList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.firewallRules().getWithResponse("testrg", "testserver", "rule1", Context.NONE); + public static void firewallRuleGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.firewallRules().getWithResponse("TestGroup", "testserver", "rule1", Context.NONE); } } ``` @@ -341,7 +360,7 @@ import com.azure.core.util.Context; /** Samples for FirewallRules ListByServer. */ public final class FirewallRulesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/FirewallRuleListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleListByServer.json */ /** * Sample code: FirewallRuleList. @@ -349,50 +368,50 @@ public final class FirewallRulesListByServerSamples { * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.firewallRules().listByServer("testrg", "testserver", Context.NONE); + manager.firewallRules().listByServer("TestGroup", "testserver", Context.NONE); } } ``` -### GetPrivateDnsZoneSuffix_Execute +### LocationBasedPerformanceTier_List ```java import com.azure.core.util.Context; -/** Samples for GetPrivateDnsZoneSuffix Execute. */ -public final class GetPrivateDnsZoneSuffixExecuteSamples { +/** Samples for LocationBasedPerformanceTier List. */ +public final class LocationBasedPerformanceTierListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/GetPrivateDnsZoneSuffix.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByLocation.json */ /** - * Sample code: GetPrivateDnsZoneSuffix. + * Sample code: PerformanceTiersList. * * @param manager Entry point to PostgreSqlManager. */ - public static void getPrivateDnsZoneSuffix( + public static void performanceTiersList( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.getPrivateDnsZoneSuffixes().executeWithResponse(Context.NONE); + manager.locationBasedPerformanceTiers().list("WestUS", Context.NONE); } } ``` -### LocationBasedCapabilities_Execute +### LogFiles_ListByServer ```java import com.azure.core.util.Context; -/** Samples for LocationBasedCapabilities Execute. */ -public final class LocationBasedCapabilitiesExecuteSamples { +/** Samples for LogFiles ListByServer. */ +public final class LogFilesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/CapabilitiesByLocation.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/LogFileListByServer.json */ /** - * Sample code: CapabilitiesList. + * Sample code: LogFileList. * * @param manager Entry point to PostgreSqlManager. */ - public static void capabilitiesList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.locationBasedCapabilities().execute("westus", Context.NONE); + public static void logFileList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.logFiles().listByServer("TestGroup", "testserver", Context.NONE); } } ``` @@ -405,7 +424,7 @@ import com.azure.core.util.Context; /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/OperationList.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/OperationList.json */ /** * Sample code: OperationList. @@ -418,78 +437,132 @@ public final class OperationsListSamples { } ``` -### Servers_Create +### PrivateEndpointConnections_CreateOrUpdate ```java -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.GeoRedundantBackupEnum; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailabilityMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Network; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; -import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; -/** Samples for Servers Create. */ -public final class ServersCreateSamples { +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json */ /** - * Sample code: Create a new server. + * Sample code: Approve or reject a private endpoint connection with a given name. * * @param manager Entry point to PostgreSqlManager. */ - public static void createANewServer(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager - .servers() - .define("pgtestsvc4") - .withRegion("westus") - .withExistingResourceGroup("testrg") - .withTags(mapOf("ElasticServer", "1")) - .withSku(new Sku().withName("Standard_D4s_v3").withTier(SkuTier.GENERAL_PURPOSE)) - .withAdministratorLogin("cloudsa") - .withAdministratorLoginPassword("password") - .withVersion(ServerVersion.ONE_TWO) - .withStorage(new Storage().withStorageSizeGB(512)) - .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED)) - .withNetwork( - new Network() - .withDelegatedSubnetResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet") - .withPrivateDnsZoneArmResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com")) - .withHighAvailability(new HighAvailability().withMode(HighAvailabilityMode.ZONE_REDUNDANT)) - .withAvailabilityZone("1") - .withCreateMode(CreateMode.CREATE) + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServer("Default", "test-svr") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) .create(); } +} +``` + +### PrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerCreatePointInTimeRestore.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json */ /** - * Sample code: Create a database as a point in time restore. + * Sample code: Deletes a private endpoint connection with a given name. * * @param manager Entry point to PostgreSqlManager. */ - public static void createADatabaseAsAPointInTimeRestore( + public static void deletesAPrivateEndpointConnectionWithAGivenName( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager - .servers() - .define("pgtestsvc5") - .withRegion("westus") - .withExistingResourceGroup("testrg") - .withSourceServerResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername") - .withPointInTimeUtc(OffsetDateTime.parse("2021-06-27T00:04:59.4078005+00:00")) - .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) - .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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_UpdateTags + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnection; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateEndpointConnections UpdateTags. */ +public final class PrivateEndpointConnectionsUpdateTagsSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json + */ + /** + * Sample code: Update private endpoint connection Tags. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updatePrivateEndpointConnectionTags( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + PrivateEndpointConnection resource = + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "val1", "key2", "val2", "key3", "val3")).apply(); } @SuppressWarnings("unchecked") @@ -505,274 +578,810 @@ 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json */ /** - * Sample code: ServerDelete. + * Sample code: Gets a private link resource for PostgreSQL. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverDelete(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().delete("testrg", "testserver", Context.NONE); + public static void getsAPrivateLinkResourceForPostgreSQL( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); } } ``` -### Servers_GetByResourceGroup +### PrivateLinkResources_ListByServer ```java import com.azure.core.util.Context; -/** Samples for Servers GetByResourceGroup. */ -public final class ServersGetByResourceGroupSamples { +/** Samples for PrivateLinkResources ListByServer. */ +public final class PrivateLinkResourcesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json */ /** - * Sample code: ServerGet. + * Sample code: Gets private link resources for PostgreSQL. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc1", Context.NONE); + public static void getsPrivateLinkResourcesForPostgreSQL( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); } +} +``` +### RecoverableServers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RecoverableServers Get. */ +public final class RecoverableServersGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerGetWithVnet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/RecoverableServersGet.json */ /** - * Sample code: ServerGetWithVnet. + * Sample code: ReplicasListByServer. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverGetWithVnet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc4", Context.NONE); + public static void replicasListByServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.recoverableServers().getWithResponse("testrg", "pgtestsvc4", Context.NONE); } } ``` -### Servers_List +### Replicas_ListByServer ```java import com.azure.core.util.Context; -/** Samples for Servers List. */ -public final class ServersListSamples { +/** Samples for Replicas ListByServer. */ +public final class ReplicasListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerList.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ReplicasListByServer.json */ /** - * Sample code: ServerList. + * Sample code: ReplicasListByServer. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().list(Context.NONE); + public static void replicasListByServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.replicas().listByServer("TestGroup_WestCentralUS", "testserver-master", Context.NONE); } } ``` -### Servers_ListByResourceGroup +### ServerAdministrators_CreateOrUpdate ```java import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.AdministratorType; +import java.util.UUID; -/** Samples for Servers ListByResourceGroup. */ -public final class ServersListByResourceGroupSamples { +/** Samples for ServerAdministrators CreateOrUpdate. */ +public final class ServerAdministratorsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerListByResourceGroup.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json */ /** - * Sample code: ServerListByResourceGroup. + * Sample code: ServerAdministratorCreate. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverListByResourceGroup( + public static void serverAdministratorCreate( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().listByResourceGroup("testrg", Context.NONE); + manager + .serverAdministrators() + .createOrUpdate( + "testrg", + "pgtestsvc4", + 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); } } ``` -### Servers_Restart +### ServerAdministrators_Delete ```java import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FailoverMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; -/** Samples for Servers Restart. */ -public final class ServersRestartSamples { +/** Samples for ServerAdministrators Delete. */ +public final class ServerAdministratorsDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerRestart.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminDelete.json */ /** - * Sample code: ServerRestart. + * Sample code: ServerAdministratorsDelete. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverRestart(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().restart("testrg", "testserver", null, Context.NONE); + public static void serverAdministratorsDelete( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverAdministrators().delete("testrg", "pgtestsvc4", Context.NONE); } +} +``` + +### ServerAdministrators_Get + +```java +import com.azure.core.util.Context; +/** Samples for ServerAdministrators Get. */ +public final class ServerAdministratorsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerRestartWithFailover.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminGet.json */ /** - * Sample code: ServerRestartWithFailover. + * Sample code: ServerAdministratorGet. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverRestartWithFailover( + public static void serverAdministratorGet( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager - .servers() - .restart( - "testrg", - "testserver", - new RestartParameter().withRestartWithFailover(true).withFailoverMode(FailoverMode.FORCED_FAILOVER), - Context.NONE); + manager.serverAdministrators().getWithResponse("testrg", "pgtestsvc4", Context.NONE); } } ``` -### Servers_Start +### ServerAdministrators_List ```java import com.azure.core.util.Context; -/** Samples for Servers Start. */ -public final class ServersStartSamples { +/** Samples for ServerAdministrators List. */ +public final class ServerAdministratorsListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerStart.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminList.json */ /** - * Sample code: ServerStart. + * Sample code: get a list of server administrators. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverStart(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().start("testrg", "testserver", Context.NONE); + public static void getAListOfServerAdministrators( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverAdministrators().list("testrg", "pgtestsvc4", Context.NONE); } } ``` -### Servers_Stop +### ServerBasedPerformanceTier_List ```java import com.azure.core.util.Context; -/** Samples for Servers Stop. */ -public final class ServersStopSamples { +/** Samples for ServerBasedPerformanceTier List. */ +public final class ServerBasedPerformanceTierListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerStop.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json */ /** - * Sample code: ServerStop. + * Sample code: PerformanceTiersList. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverStop(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().stop("testrg", "testserver", Context.NONE); + public static void performanceTiersList( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverBasedPerformanceTiers().list("TestGroup", "testserver", Context.NONE); } } ``` -### Servers_Update +### ServerKeys_CreateOrUpdate + +```java +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeyType; + +/** Samples for ServerKeys CreateOrUpdate. */ +public final class ServerKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a PostgreSQL Server key. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createsOrUpdatesAPostgreSQLServerKey( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForUpdate; -import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; -import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; -/** Samples for Servers Update. */ -public final class ServersUpdateSamples { +/** Samples for ServerKeys Delete. */ +public final class ServerKeysDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyDelete.json */ /** - * Sample code: ServerUpdate. + * Sample code: Delete the PostgreSQL Server key. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverUpdate(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - Server resource = - manager.servers().getByResourceGroupWithResponse("TestGroup", "pgtestsvc4", Context.NONE).getValue(); - resource - .update() - .withSku(new Sku().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE)) - .withAdministratorLoginPassword("newpassword") - .withStorage(new Storage().withStorageSizeGB(1024)) - .withBackup(new Backup().withBackupRetentionDays(20)) - .withCreateMode(CreateModeForUpdate.UPDATE) - .apply(); + public static void deleteThePostgreSQLServerKey( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerUpdateWithCustomerMaintenanceWindow.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json */ /** - * Sample code: ServerUpdateWithCustomerMaintenanceWindow. + * Sample code: Get the PostgreSQL Server key. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverUpdateWithCustomerMaintenanceWindow( + public static void getThePostgreSQLServerKey( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - Server resource = - manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc4", Context.NONE).getValue(); - resource - .update() - .withMaintenanceWindow( - new MaintenanceWindow() - .withCustomWindow("Enabled") - .withStartHour(8) - .withStartMinute(0) - .withDayOfWeek(0)) - .withCreateMode(CreateModeForUpdate.UPDATE) - .apply(); + manager + .serverKeys() + .getWithResponse( + "testrg", "testserver", "someVault_someKey_01234567890123456789012345678901", Context.NONE); } } ``` -### VirtualNetworkSubnetUsage_Execute +### ServerKeys_List ```java import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; -/** Samples for VirtualNetworkSubnetUsage Execute. */ -public final class VirtualNetworkSubnetUsageExecuteSamples { +/** Samples for ServerKeys List. */ +public final class ServerKeysListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/VirtualNetworkSubnetUsage.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyList.json */ /** - * Sample code: VirtualNetworkSubnetUsageList. + * Sample code: List the keys for a PostgreSQL Server. * * @param manager Entry point to PostgreSqlManager. */ - public static void virtualNetworkSubnetUsageList( + public static void listTheKeysForAPostgreSQLServer( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverKeys().list("testrg", "testserver", Context.NONE); + } +} +``` + +### ServerParameters_ListUpdateConfigurations + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; + +/** Samples for ServerParameters ListUpdateConfigurations. */ +public final class ServerParametersListUpdateConfigurationsSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json + */ + /** + * Sample code: ConfigurationList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void configurationList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager - .virtualNetworkSubnetUsages() - .executeWithResponse( - "westus", - new VirtualNetworkSubnetUsageParameter() - .withVirtualNetworkArmResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet"), - Context.NONE); + .serverParameters() + .listUpdateConfigurations("TestGroup", "testserver", new ConfigurationListResultInner(), Context.NONE); + } +} +``` + +### ServerSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicy; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicyState; +import java.util.Arrays; + +/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json + */ + /** + * Sample code: Update a server's threat detection policy with minimal parameters. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json + */ + /** + * Sample code: Update a server's threat detection policy with all parameters. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.models.SecurityAlertPolicyName; + +/** Samples for ServerSecurityAlertPolicies Get. */ +public final class ServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json + */ + /** + * Sample code: Get a server's threat detection policy. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getAServerSThreatDetectionPolicy( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json + */ + /** + * Sample code: List the server's threat detection policies. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listTheServerSThreatDetectionPolicies( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + } +} +``` + +### Servers_Create + +```java +import com.azure.resourcemanager.postgresqlflexibleserver.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForDefaultCreate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForGeoRestore; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForReplica; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForRestore; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json + */ + /** + * Sample code: Create a replica server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createAReplicaServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .servers() + .define("testserver-replica1") + .withRegion("westcentralus") + .withExistingResourceGroup("TestGroup_WestCentralUS") + .withProperties( + new ServerPropertiesForReplica() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")) + .withSku( + new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json + */ + /** + * Sample code: Create a server as a geo restore. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createAServerAsAGeoRestore( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .servers() + .define("targetserver") + .withRegion("westus") + .withExistingResourceGroup("TargetResourceGroup") + .withProperties( + new ServerPropertiesForGeoRestore() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json + */ + /** + * Sample code: Create a new server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createANewServer(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .servers() + .define("pgtestsvc4") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withProperties( + new ServerPropertiesForDefaultCreate() + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .withStorageProfile( + new StorageProfile() + .withBackupRetentionDays(7) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(128000)) + .withAdministratorLogin("cloudsa") + .withAdministratorLoginPassword("fakeTokenPlaceholder")) + .withTags(mapOf("ElasticServer", "1")) + .withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).withCapacity(2).withFamily("Gen5")) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json + */ + /** + * Sample code: Create a database as a point in time restore. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createADatabaseAsAPointInTimeRestore( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .servers() + .define("targetserver") + .withRegion("brazilsouth") + .withExistingResourceGroup("TargetResourceGroup") + .withProperties( + new ServerPropertiesForRestore() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver") + .withRestorePointInTime(OffsetDateTime.parse("2017-12-14T00:00:37.467Z"))) + .withTags(mapOf("ElasticServer", "1")) + .withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).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]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Servers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Servers Delete. */ +public final class ServersDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerDelete.json + */ + /** + * Sample code: ServerDelete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverDelete(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json + */ + /** + * Sample code: ServerGet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc1", Context.NONE); + } +} +``` + +### Servers_List + +```java +import com.azure.core.util.Context; + +/** Samples for Servers List. */ +public final class ServersListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerList.json + */ + /** + * Sample code: ServerList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerListByResourceGroup.json + */ + /** + * Sample code: ServerListByResourceGroup. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverListByResourceGroup( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.servers().listByResourceGroup("TestGroup", Context.NONE); + } +} +``` + +### Servers_Restart + +```java +import com.azure.core.util.Context; + +/** Samples for Servers Restart. */ +public final class ServersRestartSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerRestart.json + */ + /** + * Sample code: ServerRestart. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverRestart(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.servers().restart("TestGroup", "testserver", Context.NONE); + } +} +``` + +### Servers_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; + +/** Samples for Servers Update. */ +public final class ServersUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerUpdate.json + */ + /** + * Sample code: ServerUpdate. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverUpdate(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + Server resource = + manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc4", Context.NONE).getValue(); + resource + .update() + .withAdministratorLoginPassword("") + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .apply(); + } +} +``` + +### VirtualNetworkRules_CreateOrUpdate + +```java +/** Samples for VirtualNetworkRules CreateOrUpdate. */ +public final class VirtualNetworkRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json + */ + /** + * Sample code: Create or update a virtual network rule. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createOrUpdateAVirtualNetworkRule( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json + */ + /** + * Sample code: Delete a virtual network rule. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void deleteAVirtualNetworkRule( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json + */ + /** + * Sample code: Gets a virtual network rule. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getsAVirtualNetworkRule( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json + */ + /** + * Sample code: List virtual network rules. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listVirtualNetworkRules( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.virtualNetworkRules().listByServer("TestGroup", "vnet-test-svr", Context.NONE); } } ``` diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml index 3cf457634f30..2054f412d35c 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml @@ -13,7 +13,7 @@ jar Microsoft Azure SDK for PostgreSql Management - This package contains Microsoft Azure SDK for PostgreSql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-flexibleserver-2021-06. + This package contains Microsoft Azure SDK for PostgreSql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and configurations with new business model. Package tag package-2020-01-01. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java index a6e561c62497..7d2d7d8ab625 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java @@ -8,12 +8,15 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; 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; @@ -25,26 +28,45 @@ import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ConfigurationsImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.DatabasesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.FirewallRulesImpl; -import com.azure.resourcemanager.postgresqlflexibleserver.implementation.GetPrivateDnsZoneSuffixesImpl; -import com.azure.resourcemanager.postgresqlflexibleserver.implementation.LocationBasedCapabilitiesImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.LocationBasedPerformanceTiersImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.LogFilesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.OperationsImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.PostgreSqlManagementClientBuilder; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.RecoverableServersImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ReplicasImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerAdministratorsImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerBasedPerformanceTiersImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerKeysImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerParametersImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerSecurityAlertPoliciesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServersImpl; -import com.azure.resourcemanager.postgresqlflexibleserver.implementation.VirtualNetworkSubnetUsagesImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.VirtualNetworkRulesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilities; import com.azure.resourcemanager.postgresqlflexibleserver.models.Configurations; import com.azure.resourcemanager.postgresqlflexibleserver.models.Databases; import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRules; -import com.azure.resourcemanager.postgresqlflexibleserver.models.GetPrivateDnsZoneSuffixes; -import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedCapabilities; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedPerformanceTiers; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFiles; import com.azure.resourcemanager.postgresqlflexibleserver.models.Operations; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnections; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResources; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RecoverableServers; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Replicas; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerAdministrators; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerBasedPerformanceTiers; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeys; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerParameters; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicies; import com.azure.resourcemanager.postgresqlflexibleserver.models.Servers; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsages; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRules; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** * Entry point to PostgreSqlManager. The Microsoft Azure management API provides create, read, update, and delete @@ -54,21 +76,39 @@ public final class PostgreSqlManager { private Servers servers; + private Replicas replicas; + private FirewallRules firewallRules; + private VirtualNetworkRules virtualNetworkRules; + + private Databases databases; + private Configurations configurations; - private CheckNameAvailabilities checkNameAvailabilities; + private ServerParameters serverParameters; + + private LogFiles logFiles; + + private ServerAdministrators serverAdministrators; + + private RecoverableServers recoverableServers; - private LocationBasedCapabilities locationBasedCapabilities; + private ServerBasedPerformanceTiers serverBasedPerformanceTiers; - private VirtualNetworkSubnetUsages virtualNetworkSubnetUsages; + private LocationBasedPerformanceTiers locationBasedPerformanceTiers; + + private CheckNameAvailabilities checkNameAvailabilities; private Operations operations; - private Databases databases; + private ServerSecurityAlertPolicies serverSecurityAlertPolicies; + + private PrivateEndpointConnections privateEndpointConnections; - private GetPrivateDnsZoneSuffixes getPrivateDnsZoneSuffixes; + private PrivateLinkResources privateLinkResources; + + private ServerKeys serverKeys; private final PostgreSqlManagementClient clientObject; @@ -97,6 +137,19 @@ public static PostgreSqlManager authenticate(TokenCredential credential, AzurePr return configure().authenticate(credential, profile); } + /** + * Creates an instance of PostgreSql service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the PostgreSql service API instance. + */ + public static PostgreSqlManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new PostgreSqlManager(httpPipeline, profile, null); + } + /** * Gets a Configurable instance that can be used to create PostgreSqlManager with optional configuration. * @@ -108,13 +161,14 @@ public static Configurable configure() { /** The Configurable allowing configurations to be set. */ public static final class Configurable { - private final ClientLogger logger = new ClientLogger(Configurable.class); + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; + private RetryOptions retryOptions; private Duration defaultPollInterval; private Configurable() { @@ -175,6 +229,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. * @@ -182,9 +249,11 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { * @return the configurable object itself. */ public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); if (this.defaultPollInterval.isNegative()) { - throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); } return this; } @@ -206,7 +275,7 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p .append("-") .append("com.azure.resourcemanager.postgresqlflexibleserver") .append("/") - .append("1.0.0-beta.4"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -224,16 +293,34 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p 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( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = @@ -245,7 +332,11 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p } } - /** @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); @@ -253,7 +344,23 @@ public Servers servers() { return servers; } - /** @return Resource collection API of FirewallRules. */ + /** + * Gets the resource collection API of Replicas. + * + * @return Resource collection API of Replicas. + */ + public Replicas replicas() { + if (this.replicas == null) { + this.replicas = new ReplicasImpl(clientObject.getReplicas(), this); + } + return replicas; + } + + /** + * Gets 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); @@ -261,7 +368,35 @@ public FirewallRules firewallRules() { return firewallRules; } - /** @return Resource collection API of Configurations. */ + /** + * 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); + } + return databases; + } + + /** + * 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); @@ -269,7 +404,85 @@ public Configurations configurations() { return configurations; } - /** @return Resource collection API of CheckNameAvailabilities. */ + /** + * 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 serverBasedPerformanceTiers; + } + + /** + * 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 locationBasedPerformanceTiers; + } + + /** + * Gets the resource collection API of CheckNameAvailabilities. + * + * @return Resource collection API of CheckNameAvailabilities. + */ public CheckNameAvailabilities checkNameAvailabilities() { if (this.checkNameAvailabilities == null) { this.checkNameAvailabilities = @@ -278,47 +491,66 @@ public CheckNameAvailabilities checkNameAvailabilities() { return checkNameAvailabilities; } - /** @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 Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); } - return locationBasedCapabilities; + return operations; } - /** @return Resource collection API of VirtualNetworkSubnetUsages. */ - public VirtualNetworkSubnetUsages virtualNetworkSubnetUsages() { - if (this.virtualNetworkSubnetUsages == null) { - this.virtualNetworkSubnetUsages = - new VirtualNetworkSubnetUsagesImpl(clientObject.getVirtualNetworkSubnetUsages(), this); + /** + * 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 virtualNetworkSubnetUsages; + return serverSecurityAlertPolicies; } - /** @return Resource collection API of Operations. */ - public Operations operations() { - if (this.operations == null) { - this.operations = new OperationsImpl(clientObject.getOperations(), this); + /** + * 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 operations; + return privateEndpointConnections; } - /** @return Resource collection API of Databases. */ - public Databases databases() { - if (this.databases == null) { - this.databases = new DatabasesImpl(clientObject.getDatabases(), this); + /** + * 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 databases; + return privateLinkResources; } - /** @return Resource collection API of GetPrivateDnsZoneSuffixes. */ - public GetPrivateDnsZoneSuffixes getPrivateDnsZoneSuffixes() { - if (this.getPrivateDnsZoneSuffixes == null) { - this.getPrivateDnsZoneSuffixes = - new GetPrivateDnsZoneSuffixesImpl(clientObject.getGetPrivateDnsZoneSuffixes(), this); + /** + * 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 getPrivateDnsZoneSuffixes; + return serverKeys; } /** diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java index e6e3a445422e..3c3102763f84 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/CheckNameAvailabilitiesClient.java @@ -17,25 +17,25 @@ public interface CheckNameAvailabilitiesClient { * Check the availability of name for resource. * * @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. + * @return represents a resource name availability along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest); + Response executeWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context); /** * Check the availability of name for resource. * * @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. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response executeWithResponse( - NameAvailabilityRequest nameAvailabilityRequest, Context context); + NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ConfigurationsClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ConfigurationsClient.java index fdcf6840f8c2..4bb6293ac5ae 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ConfigurationsClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ConfigurationsClient.java @@ -15,63 +15,6 @@ /** An instance of this class provides access to all the operations defined in ConfigurationsClient. */ public interface ConfigurationsClient { - /** - * 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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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.COLLECTION) - PagedIterable listByServer(String resourceGroupName, String serverName); - - /** - * 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 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.COLLECTION) - PagedIterable listByServer(String resourceGroupName, String serverName, Context context); - - /** - * 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 configurationName The name of the 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 information about a configuration of server. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner get(String resourceGroupName, String serverName, String configurationName); - - /** - * 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 configurationName The name of the 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 information about a configuration of server. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse( - String resourceGroupName, String serverName, String configurationName, Context context); - /** * Updates a configuration of a server. * @@ -82,10 +25,10 @@ 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 represents a Configuration. + * @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); /** @@ -99,10 +42,10 @@ SyncPoller, ConfigurationInner> beginUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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. + * @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, @@ -122,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); /** @@ -139,7 +82,7 @@ ConfigurationInner update( * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner update( + ConfigurationInner createOrUpdate( String resourceGroupName, String serverName, String configurationName, @@ -147,76 +90,59 @@ ConfigurationInner update( Context context); /** - * Updates a configuration of a 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 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. + * @return information about a configuration of server along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ConfigurationInner> beginPut( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context); /** - * Updates a configuration of a 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 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. + * @return information about a configuration of server. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ConfigurationInner> beginPut( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationInner get(String resourceGroupName, String serverName, String configurationName); /** - * Updates a configuration of a 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 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. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner put( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); /** - * Updates a configuration of a 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 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. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner put( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/DatabasesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/DatabasesClient.java index 72c1d4ae5c25..987f75b9e350 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/DatabasesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/DatabasesClient.java @@ -25,10 +25,10 @@ public interface DatabasesClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 Database. + * @return the {@link SyncPoller} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, DatabaseInner> beginCreate( + SyncPoller, DatabaseInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); /** @@ -42,10 +42,10 @@ SyncPoller, DatabaseInner> beginCreate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 Database. + * @return the {@link SyncPoller} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, DatabaseInner> beginCreate( + SyncPoller, DatabaseInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); /** @@ -61,7 +61,8 @@ SyncPoller, DatabaseInner> beginCreate( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - DatabaseInner create(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); /** * Creates a new database or updates an existing database. @@ -77,7 +78,7 @@ SyncPoller, DatabaseInner> beginCreate( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - DatabaseInner create( + DatabaseInner createOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); /** @@ -89,7 +90,7 @@ DatabaseInner create( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String databaseName); @@ -104,7 +105,7 @@ DatabaseInner create( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( @@ -143,13 +144,15 @@ SyncPoller, Void> beginDelete( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @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 information about a database. + * @return information about a database along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - DatabaseInner get(String resourceGroupName, String serverName, String databaseName); + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); /** * Gets information about a database. @@ -157,15 +160,13 @@ SyncPoller, Void> beginDelete( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @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 information about a database. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse( - String resourceGroupName, String serverName, String databaseName, Context context); + DatabaseInner get(String resourceGroupName, String serverName, String databaseName); /** * List all the databases in a given server. @@ -175,7 +176,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 databases. + * @return a List of databases as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName); @@ -189,7 +190,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 databases. + * @return a List of databases as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FirewallRulesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FirewallRulesClient.java index 2c6d9c5a126b..d3c6e345112d 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FirewallRulesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FirewallRulesClient.java @@ -25,7 +25,7 @@ public interface FirewallRulesClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 server firewall rule. + * @return the {@link SyncPoller} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, FirewallRuleInner> beginCreateOrUpdate( @@ -42,7 +42,7 @@ SyncPoller, FirewallRuleInner> beginCreateOrUpdate * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 server firewall rule. + * @return the {@link SyncPoller} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, FirewallRuleInner> beginCreateOrUpdate( @@ -90,7 +90,7 @@ FirewallRuleInner createOrUpdate( Context context); /** - * Deletes a PostgreSQL server 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. @@ -98,14 +98,14 @@ FirewallRuleInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( String resourceGroupName, String serverName, String firewallRuleName); /** - * Deletes a PostgreSQL server 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. @@ -114,14 +114,14 @@ SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * Deletes a PostgreSQL server 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 PostgreSQL server 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. @@ -148,50 +148,50 @@ SyncPoller, Void> beginDelete( void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param firewallRuleName The name of the server firewall rule. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a server firewall rule. + * @return information about a server firewall rule along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName); + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param firewallRuleName The name of the server firewall rule. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a server firewall rule. + * @return information about a server firewall rule. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse( - String resourceGroupName, String serverName, String firewallRuleName, Context context); + FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName); /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules 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 firewall rules. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName); /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules in a given server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -199,7 +199,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 firewall rules. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java deleted file mode 100644 index 16bb5ad1c086..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** An instance of this class provides access to all the operations defined in GetPrivateDnsZoneSuffixesClient. */ -public interface GetPrivateDnsZoneSuffixesClient { - /** - * Get private DNS zone suffix in the cloud. - * - * @throws com.azure.core.management.exception.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) - String execute(); - - /** - * 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 com.azure.core.management.exception.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) - Response executeWithResponse(Context context); -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedPerformanceTiersClient.java similarity index 68% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedPerformanceTiersClient.java index ca68879783b3..d3436698ab9e 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedPerformanceTiersClient.java @@ -8,32 +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.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable execute(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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable execute(String locationName, Context context); + PagedIterable list(String locationName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LogFilesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LogFilesClient.java new file mode 100644 index 000000000000..27994158293b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.postgresqlflexibleserver.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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/OperationsClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/OperationsClient.java index 94bcbaea560e..cbd6c8bfebd0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/OperationsClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/OperationsClient.java @@ -15,22 +15,22 @@ public interface OperationsClient { /** * 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 com.azure.core.management.exception.ManagementException 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. + * @return a list of resource provider operations along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - OperationListResultInner list(); + Response listWithResponse(Context context); /** * 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 com.azure.core.management.exception.ManagementException 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response listWithResponse(Context context); + OperationListResultInner list(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java index 3ab21cdb3288..fe659f97fb27 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java @@ -23,13 +23,6 @@ public interface PostgreSqlManagementClient { */ String getEndpoint(); - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - String getApiVersion(); - /** * Gets The HTTP pipeline to send requests through. * @@ -51,6 +44,13 @@ public interface PostgreSqlManagementClient { */ ServersClient getServers(); + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + ReplicasClient getReplicas(); + /** * Gets the FirewallRulesClient object to access its operations. * @@ -58,6 +58,20 @@ public interface PostgreSqlManagementClient { */ FirewallRulesClient getFirewallRules(); + /** + * Gets the VirtualNetworkRulesClient object to access its operations. + * + * @return the VirtualNetworkRulesClient object. + */ + VirtualNetworkRulesClient getVirtualNetworkRules(); + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + DatabasesClient getDatabases(); + /** * Gets the ConfigurationsClient object to access its operations. * @@ -66,25 +80,53 @@ public interface PostgreSqlManagementClient { ConfigurationsClient getConfigurations(); /** - * Gets the CheckNameAvailabilitiesClient object to access its operations. + * Gets the ServerParametersClient object to access its operations. * - * @return the CheckNameAvailabilitiesClient object. + * @return the ServerParametersClient object. */ - CheckNameAvailabilitiesClient getCheckNameAvailabilities(); + ServerParametersClient getServerParameters(); + + /** + * Gets the LogFilesClient object to access its operations. + * + * @return the LogFilesClient object. + */ + LogFilesClient getLogFiles(); /** - * Gets the LocationBasedCapabilitiesClient object to access its operations. + * Gets the ServerAdministratorsClient object to access its operations. * - * @return the LocationBasedCapabilitiesClient object. + * @return the ServerAdministratorsClient object. */ - LocationBasedCapabilitiesClient getLocationBasedCapabilities(); + ServerAdministratorsClient getServerAdministrators(); /** - * Gets the VirtualNetworkSubnetUsagesClient object to access its operations. + * Gets the RecoverableServersClient object to access its operations. * - * @return the VirtualNetworkSubnetUsagesClient object. + * @return the RecoverableServersClient object. */ - VirtualNetworkSubnetUsagesClient getVirtualNetworkSubnetUsages(); + 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 CheckNameAvailabilitiesClient object to access its operations. + * + * @return the CheckNameAvailabilitiesClient object. + */ + CheckNameAvailabilitiesClient getCheckNameAvailabilities(); /** * Gets the OperationsClient object to access its operations. @@ -94,16 +136,30 @@ public interface PostgreSqlManagementClient { OperationsClient getOperations(); /** - * Gets the DatabasesClient object to access its operations. + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. * - * @return the DatabasesClient object. + * @return the ServerSecurityAlertPoliciesClient object. */ - DatabasesClient getDatabases(); + ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies(); + + /** + * 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 GetPrivateDnsZoneSuffixesClient object to access its operations. + * Gets the ServerKeysClient object to access its operations. * - * @return the GetPrivateDnsZoneSuffixesClient object. + * @return the ServerKeysClient object. */ - GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes(); + ServerKeysClient getServerKeys(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateEndpointConnectionsClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..fd787d33098e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.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.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlflexibleserver.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. + * @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); + + /** + * 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); + + /** + * 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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateLinkResourcesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 000000000000..e660f071c43c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.postgresqlflexibleserver.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 PostgreSQL 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 PostgreSQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); + + /** + * Gets a private link resource for PostgreSQL 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 PostgreSQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/RecoverableServersClient.java similarity index 54% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/RecoverableServersClient.java index 36279e65b3a7..75692dc8823d 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/RecoverableServersClient.java @@ -8,36 +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.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner; -/** An instance of this class provides access to all the operations defined in VirtualNetworkSubnetUsagesClient. */ -public interface VirtualNetworkSubnetUsagesClient { +/** An instance of this class provides access to all the operations defined in RecoverableServersClient. */ +public interface RecoverableServersClient { /** - * Get virtual network subnet usage for a given vNet resource id. + * Gets a recoverable PostgreSQL Server. * - * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating 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 virtual network subnet usage for a given vNet resource id. + * @return a recoverable PostgreSQL Server along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - VirtualNetworkSubnetUsageResultInner execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); + Response getWithResponse( + String resourceGroupName, String serverName, Context context); /** - * Get virtual network subnet usage for a given vNet resource id. + * Gets a recoverable PostgreSQL Server. * - * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. - * @param context The context to associate with this operation. + * @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 virtual network subnet usage for a given vNet resource id. + * @return a recoverable PostgreSQL Server. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context); + RecoverableServerResourceInner get(String resourceGroupName, String serverName); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ReplicasClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ReplicasClient.java new file mode 100644 index 000000000000..68f1378bbd27 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ReplicasClient.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.postgresqlflexibleserver.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.postgresqlflexibleserver.fluent.models.ServerInner; + +/** An instance of this class provides access to all the operations defined in ReplicasClient. */ +public interface ReplicasClient { + /** + * List all the replicas for 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 servers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the replicas for 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 servers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerAdministratorsClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerAdministratorsClient.java new file mode 100644 index 000000000000..9a8e33f45199 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.postgresqlflexibleserver.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. + * @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); + + /** + * 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); + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerBasedPerformanceTiersClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerBasedPerformanceTiersClient.java new file mode 100644 index 000000000000..7e3d4bcd2615 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.postgresqlflexibleserver.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 PostgreSQL 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 PostgreSQL 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerKeysClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerKeysClient.java new file mode 100644 index 000000000000..1e303cbddeb8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.postgresqlflexibleserver.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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context); + + /** + * Gets a PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner get(String resourceGroupName, String serverName, String keyName); + + /** + * Creates or updates a PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters); + + /** + * Creates or updates a PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner createOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters); + + /** + * Creates or updates a PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner createOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context); + + /** + * Deletes the PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerParametersClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerParametersClient.java new file mode 100644 index 000000000000..9065d1c37d0a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.postgresqlflexibleserver.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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerSecurityAlertPoliciesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerSecurityAlertPoliciesClient.java new file mode 100644 index 000000000000..867647eb04e2 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.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. + * @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); + + /** + * 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); + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServersClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServersClient.java index 5c60b9cd4c9a..ad7ea5406d82 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServersClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServersClient.java @@ -12,13 +12,13 @@ import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForUpdate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForCreate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerUpdateParameters; /** An instance of this class provides access to all the operations defined in ServersClient. */ public interface ServersClient { /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -26,14 +26,14 @@ public interface ServersClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 server. + * @return the {@link SyncPoller} for polling of represents a server. */ @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. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -42,14 +42,14 @@ SyncPoller, ServerInner> beginCreate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 server. + * @return the {@link SyncPoller} for polling of represents a server. */ @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. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -60,10 +60,10 @@ 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. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -75,7 +75,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 @@ -87,11 +87,11 @@ SyncPoller, ServerInner> beginCreate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 server. + * @return the {@link SyncPoller} for polling of represents a server. */ @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 @@ -104,11 +104,11 @@ SyncPoller, ServerInner> beginUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 server. + * @return the {@link SyncPoller} for polling of represents a server. */ @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 +123,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 +139,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. @@ -149,7 +149,7 @@ SyncPoller, ServerInner> beginUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String serverName); @@ -163,7 +163,7 @@ SyncPoller, ServerInner> beginUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @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); @@ -198,27 +198,27 @@ SyncPoller, ServerInner> beginUpdate( * * @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 server. + * @return information about a server along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner getByResourceGroup(String resourceGroupName, String serverName); + Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, Context context); /** * Gets information about 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 information about a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, Context context); + ServerInner getByResourceGroup(String resourceGroupName, String serverName); /** * List all the servers in a given resource group. @@ -227,7 +227,7 @@ SyncPoller, ServerInner> beginUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName); @@ -240,7 +240,7 @@ SyncPoller, ServerInner> beginUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName, Context context); @@ -250,7 +250,7 @@ SyncPoller, ServerInner> beginUpdate( * * @throws com.azure.core.management.exception.ManagementException 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); @@ -262,7 +262,7 @@ SyncPoller, ServerInner> beginUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); @@ -272,44 +272,27 @@ SyncPoller, ServerInner> beginUpdate( * * @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 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 completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, RestartParameter parameters); + SyncPoller, Void> beginRestart(String resourceGroupName, String serverName); /** * Restarts a 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 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. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, RestartParameter parameters, Context context); - - /** - * Restarts a 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 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, RestartParameter parameters); + SyncPoller, Void> beginRestart(String resourceGroupName, String serverName, Context context); /** * Restarts a server. @@ -328,116 +311,11 @@ SyncPoller, Void> beginRestart( * * @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 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, RestartParameter parameters, Context context); - - /** - * Starts 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStart(String resourceGroupName, String serverName); - - /** - * Starts 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStart(String resourceGroupName, String serverName, Context context); - - /** - * Starts 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void start(String resourceGroupName, String serverName); - - /** - * Starts 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void start(String resourceGroupName, String serverName, Context context); - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStop(String resourceGroupName, String serverName); - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStop(String resourceGroupName, String serverName, Context context); - - /** - * Stops 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void stop(String resourceGroupName, String serverName); - - /** - * Stops 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - void stop(String resourceGroupName, String serverName, Context context); + void restart(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkRulesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkRulesClient.java new file mode 100644 index 000000000000..8d2a6785b6f7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.postgresqlflexibleserver.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. + * @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); + + /** + * 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); + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java deleted file mode 100644 index eb94b8598405..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerEditionCapability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HyperscaleNodeEditionCapability; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Location capabilities. */ -@Immutable -public final class CapabilityPropertiesInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(CapabilityPropertiesInner.class); - - /* - * zone name - */ - @JsonProperty(value = "zone", access = JsonProperty.Access.WRITE_ONLY) - private String zone; - - /* - * A value indicating whether a new server in this region can have - * geo-backups to paired region. - */ - @JsonProperty(value = "geoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean geoBackupSupported; - - /* - * A value indicating whether a new server in this region can support multi - * zone HA. - */ - @JsonProperty(value = "zoneRedundantHaSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean zoneRedundantHaSupported; - - /* - * A value indicating whether a new server in this region can have - * geo-backups to paired region. - */ - @JsonProperty(value = "zoneRedundantHaAndGeoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean zoneRedundantHaAndGeoBackupSupported; - - /* - * The supportedFlexibleServerEditions property. - */ - @JsonProperty(value = "supportedFlexibleServerEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedFlexibleServerEditions; - - /* - * The supportedHyperscaleNodeEditions property. - */ - @JsonProperty(value = "supportedHyperscaleNodeEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedHyperscaleNodeEditions; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the zone property: zone name. - * - * @return the zone value. - */ - public String zone() { - return this.zone; - } - - /** - * Get the geoBackupSupported property: A value indicating whether a new server in this region can have geo-backups - * to paired region. - * - * @return the geoBackupSupported value. - */ - public Boolean geoBackupSupported() { - return this.geoBackupSupported; - } - - /** - * Get the zoneRedundantHaSupported property: A value indicating whether a new server in this region can support - * multi zone HA. - * - * @return the zoneRedundantHaSupported value. - */ - public Boolean zoneRedundantHaSupported() { - return this.zoneRedundantHaSupported; - } - - /** - * Get the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether a new server in this region can - * have geo-backups to paired region. - * - * @return the zoneRedundantHaAndGeoBackupSupported value. - */ - public Boolean zoneRedundantHaAndGeoBackupSupported() { - return this.zoneRedundantHaAndGeoBackupSupported; - } - - /** - * Get the supportedFlexibleServerEditions property: The supportedFlexibleServerEditions property. - * - * @return the supportedFlexibleServerEditions value. - */ - public List supportedFlexibleServerEditions() { - return this.supportedFlexibleServerEditions; - } - - /** - * Get the supportedHyperscaleNodeEditions property: The supportedHyperscaleNodeEditions property. - * - * @return the supportedHyperscaleNodeEditions value. - */ - public List supportedHyperscaleNodeEditions() { - return this.supportedHyperscaleNodeEditions; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedFlexibleServerEditions() != null) { - supportedFlexibleServerEditions().forEach(e -> e.validate()); - } - if (supportedHyperscaleNodeEditions() != null) { - supportedHyperscaleNodeEditions().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationInner.java index bd1de5ff9f12..7f6d87282b32 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationInner.java @@ -6,28 +6,20 @@ 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.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationDataType; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Represents a Configuration. */ @Fluent public final class ConfigurationInner extends ProxyResource { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationInner.class); - /* * The properties of a configuration. */ @JsonProperty(value = "properties") private ConfigurationProperties innerProperties; - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; + /** Creates an instance of ConfigurationInner class. */ + public ConfigurationInner() { + } /** * Get the innerProperties property: The properties of a configuration. @@ -38,15 +30,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. * @@ -93,7 +76,7 @@ public String defaultValue() { * * @return the dataType value. */ - public ConfigurationDataType dataType() { + public String dataType() { return this.innerProperties() == null ? null : this.innerProperties().dataType(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationListResultInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationListResultInner.java new file mode 100644 index 000000000000..7fab1fccbbbc --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationListResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server configurations. */ +@Fluent +public final class ConfigurationListResultInner { + /* + * The list of server configurations. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of ConfigurationListResultInner class. */ + public ConfigurationListResultInner() { + } + + /** + * Get the value property: The list of server configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server configurations. + * + * @param value the value value to set. + * @return the ConfigurationListResultInner object itself. + */ + public ConfigurationListResultInner 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationProperties.java index d066973fef35..14dd9dbab4f0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationProperties.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationProperties.java @@ -5,16 +5,11 @@ package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationDataType; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** The properties of a configuration. */ @Fluent public final class ConfigurationProperties { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationProperties.class); - /* * Value of the configuration. */ @@ -37,7 +32,7 @@ public final class ConfigurationProperties { * Data type of the configuration. */ @JsonProperty(value = "dataType", access = JsonProperty.Access.WRITE_ONLY) - private ConfigurationDataType dataType; + private String dataType; /* * Allowed values of the configuration. @@ -51,6 +46,10 @@ public final class ConfigurationProperties { @JsonProperty(value = "source") private String source; + /** Creates an instance of ConfigurationProperties class. */ + public ConfigurationProperties() { + } + /** * Get the value property: Value of the configuration. * @@ -94,7 +93,7 @@ public String defaultValue() { * * @return the dataType value. */ - public ConfigurationDataType dataType() { + public String dataType() { return this.dataType; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseInner.java index 2a86489446c8..8c1b7b16d59e 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseInner.java @@ -6,27 +6,20 @@ 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.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Represents a Database. */ @Fluent public final class DatabaseInner extends ProxyResource { - @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseInner.class); - /* * The properties of a database. */ @JsonProperty(value = "properties") private DatabaseProperties innerProperties; - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; + /** Creates an instance of DatabaseInner class. */ + public DatabaseInner() { + } /** * Get the innerProperties property: The properties of a database. @@ -37,15 +30,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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseProperties.java index d97032576842..b3eee890822f 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseProperties.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseProperties.java @@ -5,15 +5,11 @@ package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** The properties of a database. */ @Fluent public final class DatabaseProperties { - @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseProperties.class); - /* * The charset of the database. */ @@ -26,6 +22,10 @@ public final class DatabaseProperties { @JsonProperty(value = "collation") private String collation; + /** Creates an instance of DatabaseProperties class. */ + public DatabaseProperties() { + } + /** * Get the charset property: The charset of the database. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleInner.java index fa3322e057ba..03515fe0ba7d 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleInner.java @@ -6,27 +6,21 @@ 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.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Represents a server firewall rule. */ @Fluent public final class FirewallRuleInner extends ProxyResource { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleInner.class); - /* * The properties of a firewall rule. */ @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; + /** Creates an instance of FirewallRuleInner class. */ + public FirewallRuleInner() { + } /** * Get the innerProperties property: The properties of a firewall rule. @@ -37,15 +31,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. * @@ -99,7 +84,7 @@ public FirewallRuleInner withEndIpAddress(String endIpAddress) { */ public void validate() { if (innerProperties() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( "Missing required property innerProperties in model FirewallRuleInner")); @@ -107,4 +92,6 @@ public void validate() { innerProperties().validate(); } } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleInner.class); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleProperties.java index 16d81278ad02..680de70ed997 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleProperties.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleProperties.java @@ -6,14 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** The properties of a server firewall rule. */ @Fluent public final class FirewallRuleProperties { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleProperties.class); - /* * The start IP address of the server firewall rule. Must be IPv4 format. */ @@ -26,6 +23,10 @@ public final class FirewallRuleProperties { @JsonProperty(value = "endIpAddress", required = true) private String endIpAddress; + /** Creates an instance of FirewallRuleProperties class. */ + public FirewallRuleProperties() { + } + /** * Get the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. * @@ -73,16 +74,18 @@ public FirewallRuleProperties withEndIpAddress(String endIpAddress) { */ public void validate() { if (startIpAddress() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( "Missing required property startIpAddress in model FirewallRuleProperties")); } if (endIpAddress() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( "Missing required property endIpAddress in model FirewallRuleProperties")); } } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleProperties.class); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileInner.java new file mode 100644 index 000000000000..2f8a8a66cf9f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileInner.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.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; + + /** Creates an instance of LogFileInner class. */ + public LogFileInner() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileProperties.java new file mode 100644 index 000000000000..9831c88cd856 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileProperties.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.postgresqlflexibleserver.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; + + /** Creates an instance of LogFileProperties class. */ + public LogFileProperties() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/NameAvailabilityInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/NameAvailabilityInner.java index 3cd7e88f34d8..83a6054a6cae 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/NameAvailabilityInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/NameAvailabilityInner.java @@ -5,15 +5,11 @@ package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Represents a resource name availability. */ @Fluent public final class NameAvailabilityInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityInner.class); - /* * Error Message. */ @@ -27,16 +23,14 @@ public final class NameAvailabilityInner { private Boolean nameAvailable; /* - * name of the PostgreSQL server. + * Reason for name being unavailable. */ - @JsonProperty(value = "name") - private String name; + @JsonProperty(value = "reason") + private String reason; - /* - * type of the server - */ - @JsonProperty(value = "type") - private String type; + /** Creates an instance of NameAvailabilityInner class. */ + public NameAvailabilityInner() { + } /** * Get the message property: Error Message. @@ -79,42 +73,22 @@ public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { } /** - * Get the name property: name of the PostgreSQL server. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: name of the PostgreSQL server. - * - * @param name the name value to set. - * @return the NameAvailabilityInner object itself. - */ - public NameAvailabilityInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the type property: type of the server. + * Get the reason property: Reason for name being unavailable. * - * @return the type value. + * @return the reason value. */ - public String type() { - return this.type; + public String reason() { + return this.reason; } /** - * Set the type property: type of the server. + * Set the reason property: Reason for name being unavailable. * - * @param type the type value to set. + * @param reason the reason value to set. * @return the NameAvailabilityInner object itself. */ - public NameAvailabilityInner withType(String type) { - this.type = type; + public NameAvailabilityInner withReason(String reason) { + this.reason = reason; return this; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/OperationListResultInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/OperationListResultInner.java index 6f38a5cc24bf..2c3f69204bfc 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/OperationListResultInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/OperationListResultInner.java @@ -5,32 +5,25 @@ package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.postgresqlflexibleserver.models.Operation; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** A list of resource provider operations. */ @Fluent public final class OperationListResultInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResultInner.class); - /* - * Collection of available operation details + * The list of resource provider operations. */ @JsonProperty(value = "value") private List value; - /* - * URL client should use to fetch the next page (per server side paging). - * It's null for now, added for future use. - */ - @JsonProperty(value = "nextLink") - private String nextLink; + /** Creates an instance of OperationListResultInner class. */ + public OperationListResultInner() { + } /** - * Get the value property: Collection of available operation details. + * Get the value property: The list of resource provider operations. * * @return the value value. */ @@ -39,7 +32,7 @@ public List value() { } /** - * Set the value property: Collection of available operation details. + * Set the value property: The list of resource provider operations. * * @param value the value value to set. * @return the OperationListResultInner object itself. @@ -49,28 +42,6 @@ public OperationListResultInner withValue(List value) { return this; } - /** - * Get the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * - * @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). It's null for - * now, added for future use. - * - * @param nextLink the nextLink value to set. - * @return the OperationListResultInner object itself. - */ - public OperationListResultInner withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PerformanceTierPropertiesInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PerformanceTierPropertiesInner.java new file mode 100644 index 000000000000..b726369c8fb7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PerformanceTierPropertiesInner.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.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of PerformanceTierPropertiesInner class. */ + public PerformanceTierPropertiesInner() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateEndpointConnectionInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..bd5bf4143147 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of PrivateEndpointConnectionInner class. */ + public PrivateEndpointConnectionInner() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..795eee89609d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateEndpointConnectionProperties.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.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of PrivateEndpointConnectionProperties class. */ + public PrivateEndpointConnectionProperties() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateLinkResourceInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 000000000000..782817b04cf6 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateLinkResourceInner.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.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of PrivateLinkResourceInner class. */ + public PrivateLinkResourceInner() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/RecoverableServerProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/RecoverableServerProperties.java new file mode 100644 index 000000000000..4fd7aa7cb636 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/RecoverableServerProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSQL version + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** Creates an instance of RecoverableServerProperties class. */ + public RecoverableServerProperties() { + } + + /** + * 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 PostgreSQL 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/RecoverableServerResourceInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/RecoverableServerResourceInner.java new file mode 100644 index 000000000000..b13e7362f9e8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/RecoverableServerResourceInner.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.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recoverable server resource. */ +@Immutable +public final class RecoverableServerResourceInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RecoverableServerProperties innerProperties; + + /** Creates an instance of RecoverableServerResourceInner class. */ + public RecoverableServerResourceInner() { + } + + /** + * 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 PostgreSQL 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/SecurityAlertPolicyProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/SecurityAlertPolicyProperties.java new file mode 100644 index 000000000000..e17e7664eeb7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/SecurityAlertPolicyProperties.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.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of SecurityAlertPolicyProperties class. */ + public SecurityAlertPolicyProperties() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerAdministratorProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerAdministratorProperties.java new file mode 100644 index 000000000000..15c0ff72c97f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerAdministratorProperties.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.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of ServerAdministratorProperties class. */ + public ServerAdministratorProperties() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerAdministratorResourceInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerAdministratorResourceInner.java new file mode 100644 index 000000000000..b662cd971ae5 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerAdministratorResourceInner.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of ServerAdministratorResourceInner class. */ + public ServerAdministratorResourceInner() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java index 87b5f685dacc..a25d550ad268 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java @@ -6,26 +6,29 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Network; +import com.azure.resourcemanager.postgresqlflexibleserver.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ResourceIdentity; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPrivateEndpointConnection; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerState; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.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 { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerInner.class); + /* + * The Azure Active Directory identity of the server. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; /* * The SKU (pricing tier) of the server. @@ -39,11 +42,29 @@ public final class ServerInner extends Resource { @JsonProperty(value = "properties") private ServerProperties innerProperties; - /* - * The system metadata relating to this resource. + /** Creates an instance of ServerInner class. */ + public ServerInner() { + } + + /** + * Get the identity property: The Azure Active Directory identity of the server. + * + * @return the identity value. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; + 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 ServerInner object itself. + */ + public ServerInner withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } /** * Get the sku property: The SKU (pricing tier) of the server. @@ -74,15 +95,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) { @@ -123,310 +135,300 @@ public ServerInner withAdministratorLogin(String administratorLogin) { } /** - * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * Get the version property: Server version. * - * @return the administratorLoginPassword value. + * @return the version value. */ - public String administratorLoginPassword() { - return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); + public ServerVersion version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); } /** - * Set the administratorLoginPassword property: The administrator login password (required for server creation). + * Set the version property: Server version. * - * @param administratorLoginPassword the administratorLoginPassword value to set. + * @param version the version value to set. * @return the ServerInner object itself. */ - public ServerInner withAdministratorLoginPassword(String administratorLoginPassword) { + public ServerInner withVersion(ServerVersion version) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + this.innerProperties().withVersion(version); return this; } /** - * Get the version property: PostgreSQL Server version. + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @return the version value. + * @return the sslEnforcement value. */ - public ServerVersion version() { - return this.innerProperties() == null ? null : this.innerProperties().version(); + public SslEnforcementEnum sslEnforcement() { + return this.innerProperties() == null ? null : this.innerProperties().sslEnforcement(); } /** - * Set the version property: PostgreSQL Server version. + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @param version the version value to set. + * @param sslEnforcement the sslEnforcement value to set. * @return the ServerInner object itself. */ - public ServerInner withVersion(ServerVersion version) { + public ServerInner withSslEnforcement(SslEnforcementEnum sslEnforcement) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withVersion(version); + this.innerProperties().withSslEnforcement(sslEnforcement); return this; } /** - * Get the minorVersion property: The minor version of the server. + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the minorVersion value. + * @return the minimalTlsVersion value. */ - public String minorVersion() { - return this.innerProperties() == null ? null : this.innerProperties().minorVersion(); + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); } /** - * Get the state property: A state of a server that is visible to user. + * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the state value. + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerInner object itself. */ - public ServerState state() { - return this.innerProperties() == null ? null : this.innerProperties().state(); + public ServerInner withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; } /** - * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * Get the byokEnforcement property: Status showing whether the server data encryption is enabled with + * customer-managed keys. * - * @return the fullyQualifiedDomainName value. + * @return the byokEnforcement value. */ - public String fullyQualifiedDomainName() { - return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + public String byokEnforcement() { + return this.innerProperties() == null ? null : this.innerProperties().byokEnforcement(); } /** - * Get the storage property: Storage properties of a server. + * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @return the storage value. + * @return the infrastructureEncryption value. */ - public Storage storage() { - return this.innerProperties() == null ? null : this.innerProperties().storage(); + public InfrastructureEncryption infrastructureEncryption() { + return this.innerProperties() == null ? null : this.innerProperties().infrastructureEncryption(); } /** - * Set the storage property: Storage properties of a server. + * Set the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @param storage the storage value to set. + * @param infrastructureEncryption the infrastructureEncryption value to set. * @return the ServerInner object itself. */ - public ServerInner withStorage(Storage storage) { + public ServerInner withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withStorage(storage); + this.innerProperties().withInfrastructureEncryption(infrastructureEncryption); return this; } /** - * Get the backup property: Backup properties of a server. + * Get the userVisibleState property: A state of a server that is visible to user. * - * @return the backup value. + * @return the userVisibleState value. */ - public Backup backup() { - return this.innerProperties() == null ? null : this.innerProperties().backup(); + public ServerState userVisibleState() { + return this.innerProperties() == null ? null : this.innerProperties().userVisibleState(); } /** - * Set the backup property: Backup properties of a server. + * Set the userVisibleState property: A state of a server that is visible to user. * - * @param backup the backup value to set. + * @param userVisibleState the userVisibleState value to set. * @return the ServerInner object itself. */ - public ServerInner withBackup(Backup backup) { + public ServerInner withUserVisibleState(ServerState userVisibleState) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withBackup(backup); + this.innerProperties().withUserVisibleState(userVisibleState); return this; } /** - * Get the network property: Network properties of a server. + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @return the network value. + * @return the fullyQualifiedDomainName value. */ - public Network network() { - return this.innerProperties() == null ? null : this.innerProperties().network(); + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); } /** - * Set the network property: Network properties of a server. + * Set the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @param network the network value to set. + * @param fullyQualifiedDomainName the fullyQualifiedDomainName value to set. * @return the ServerInner object itself. */ - public ServerInner withNetwork(Network network) { + public ServerInner withFullyQualifiedDomainName(String fullyQualifiedDomainName) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withNetwork(network); + this.innerProperties().withFullyQualifiedDomainName(fullyQualifiedDomainName); return this; } /** - * Get the highAvailability property: High availability properties of a server. + * Get the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the highAvailability value. + * @return the earliestRestoreDate value. */ - public HighAvailability highAvailability() { - return this.innerProperties() == null ? null : this.innerProperties().highAvailability(); + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); } /** - * Set the highAvailability property: High availability properties of a server. + * Set the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @param highAvailability the highAvailability value to set. + * @param earliestRestoreDate the earliestRestoreDate value to set. * @return the ServerInner object itself. */ - public ServerInner withHighAvailability(HighAvailability highAvailability) { + public ServerInner withEarliestRestoreDate(OffsetDateTime earliestRestoreDate) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withHighAvailability(highAvailability); + this.innerProperties().withEarliestRestoreDate(earliestRestoreDate); return this; } /** - * Get the maintenanceWindow property: Maintenance window properties of a server. + * Get the storageProfile property: Storage profile of a server. * - * @return the maintenanceWindow value. + * @return the storageProfile value. */ - public MaintenanceWindow maintenanceWindow() { - return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow(); + public StorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); } /** - * Set the maintenanceWindow property: Maintenance window properties of a server. + * Set the storageProfile property: Storage profile of a server. * - * @param maintenanceWindow the maintenanceWindow value to set. + * @param storageProfile the storageProfile value to set. * @return the ServerInner object itself. */ - public ServerInner withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { + public ServerInner withStorageProfile(StorageProfile storageProfile) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withMaintenanceWindow(maintenanceWindow); + this.innerProperties().withStorageProfile(storageProfile); return this; } /** - * Get the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * Get the replicationRole property: The replication role of the server. * - * @return the sourceServerResourceId value. + * @return the replicationRole value. */ - public String sourceServerResourceId() { - return this.innerProperties() == null ? null : this.innerProperties().sourceServerResourceId(); + public String replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); } /** - * Set the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * Set the replicationRole property: The replication role of the server. * - * @param sourceServerResourceId the sourceServerResourceId value to set. + * @param replicationRole the replicationRole value to set. * @return the ServerInner object itself. */ - public ServerInner withSourceServerResourceId(String sourceServerResourceId) { + public ServerInner withReplicationRole(String replicationRole) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withSourceServerResourceId(sourceServerResourceId); + this.innerProperties().withReplicationRole(replicationRole); return this; } /** - * Get the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore'. + * Get the masterServerId property: The master server id of a replica server. * - * @return the pointInTimeUtc value. + * @return the masterServerId value. */ - public OffsetDateTime pointInTimeUtc() { - return this.innerProperties() == null ? null : this.innerProperties().pointInTimeUtc(); + public String masterServerId() { + return this.innerProperties() == null ? null : this.innerProperties().masterServerId(); } /** - * Set the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore'. + * Set the masterServerId property: The master server id of a replica server. * - * @param pointInTimeUtc the pointInTimeUtc value to set. + * @param masterServerId the masterServerId value to set. * @return the ServerInner object itself. */ - public ServerInner withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { + public ServerInner withMasterServerId(String masterServerId) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withPointInTimeUtc(pointInTimeUtc); + this.innerProperties().withMasterServerId(masterServerId); return this; } /** - * Get the availabilityZone property: availability zone information of the server. + * Get the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @return the availabilityZone value. + * @return the replicaCapacity value. */ - public String availabilityZone() { - return this.innerProperties() == null ? null : this.innerProperties().availabilityZone(); + public Integer replicaCapacity() { + return this.innerProperties() == null ? null : this.innerProperties().replicaCapacity(); } /** - * Set the availabilityZone property: availability zone information of the server. + * Set the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @param availabilityZone the availabilityZone value to set. + * @param replicaCapacity the replicaCapacity value to set. * @return the ServerInner object itself. */ - public ServerInner withAvailabilityZone(String availabilityZone) { + public ServerInner withReplicaCapacity(Integer replicaCapacity) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withAvailabilityZone(availabilityZone); + this.innerProperties().withReplicaCapacity(replicaCapacity); return this; } /** - * Get the createMode property: The mode to create a new PostgreSQL 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 createMode value. + * @return the publicNetworkAccess value. */ - public CreateMode createMode() { - return this.innerProperties() == null ? null : this.innerProperties().createMode(); + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); } /** - * Set the createMode property: The mode to create a new PostgreSQL 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 createMode the createMode value to set. + * @param publicNetworkAccess the publicNetworkAccess value to set. * @return the ServerInner object itself. */ - public ServerInner withCreateMode(CreateMode createMode) { + public ServerInner withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { if (this.innerProperties() == null) { this.innerProperties = new ServerProperties(); } - this.innerProperties().withCreateMode(createMode); + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); return this; } /** - * Get the tags property: Application-specific metadata in the form of key-value pairs. - * - * @return the tags value. - */ - public Map tagsPropertiesTags() { - return this.innerProperties() == null ? null : this.innerProperties().tags(); - } - - /** - * Set the tags property: Application-specific metadata in the form of key-value pairs. + * Get the privateEndpointConnections property: List of private endpoint connections on a server. * - * @param tags the tags value to set. - * @return the ServerInner object itself. + * @return the privateEndpointConnections value. */ - public ServerInner withTagsPropertiesTags(Map tags) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerProperties(); - } - this.innerProperties().withTags(tags); - return this; + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); } /** @@ -435,6 +437,9 @@ public ServerInner withTagsPropertiesTags(Map tags) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (identity() != null) { + identity().validate(); + } if (sku() != null) { sku().validate(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerKeyInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerKeyInner.java new file mode 100644 index 000000000000..2636e19326d9 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerKeyInner.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A PostgreSQL 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; + + /** Creates an instance of ServerKeyInner class. */ + public ServerKeyInner() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerKeyProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerKeyProperties.java new file mode 100644 index 000000000000..bc2d02e3b385 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerKeyProperties.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of ServerKeyProperties class. */ + public ServerKeyProperties() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerProperties.java index 554c01900914..046175f257da 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerProperties.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerProperties.java @@ -5,125 +5,116 @@ package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Network; +import com.azure.resourcemanager.postgresqlflexibleserver.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPrivateEndpointConnection; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerState; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageProfile; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; -import java.util.Map; +import java.util.List; /** The properties of a server. */ @Fluent public final class ServerProperties { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerProperties.class); - /* - * The administrator's login name of a server. Can only be specified when - * the server is being created (and is required for creation). + * The administrator's login name of a server. Can only be specified when the server is being created (and is + * required for creation). */ @JsonProperty(value = "administratorLogin") private String administratorLogin; /* - * The administrator login password (required for server creation). - */ - @JsonProperty(value = "administratorLoginPassword") - private String administratorLoginPassword; - - /* - * PostgreSQL Server version. + * Server version. */ @JsonProperty(value = "version") private ServerVersion version; /* - * The minor version of the server. + * Enable ssl enforcement or not when connect to server. */ - @JsonProperty(value = "minorVersion", access = JsonProperty.Access.WRITE_ONLY) - private String minorVersion; + @JsonProperty(value = "sslEnforcement") + private SslEnforcementEnum sslEnforcement; /* - * A state of a server that is visible to user. + * Enforce a minimal Tls version for the server. */ - @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) - private ServerState state; + @JsonProperty(value = "minimalTlsVersion") + private MinimalTlsVersionEnum minimalTlsVersion; /* - * The fully qualified domain name of a server. + * Status showing whether the server data encryption is enabled with customer-managed keys. */ - @JsonProperty(value = "fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) - private String fullyQualifiedDomainName; + @JsonProperty(value = "byokEnforcement", access = JsonProperty.Access.WRITE_ONLY) + private String byokEnforcement; /* - * Storage properties of a server. + * Status showing whether the server enabled infrastructure encryption. */ - @JsonProperty(value = "storage") - private Storage storage; + @JsonProperty(value = "infrastructureEncryption") + private InfrastructureEncryption infrastructureEncryption; /* - * Backup properties of a server. + * A state of a server that is visible to user. */ - @JsonProperty(value = "backup") - private Backup backup; + @JsonProperty(value = "userVisibleState") + private ServerState userVisibleState; /* - * Network properties of a server. + * The fully qualified domain name of a server. */ - @JsonProperty(value = "network") - private Network network; + @JsonProperty(value = "fullyQualifiedDomainName") + private String fullyQualifiedDomainName; /* - * High availability properties of a server. + * Earliest restore point creation time (ISO8601 format) */ - @JsonProperty(value = "highAvailability") - private HighAvailability highAvailability; + @JsonProperty(value = "earliestRestoreDate") + private OffsetDateTime earliestRestoreDate; /* - * Maintenance window properties of a server. + * Storage profile of a server. */ - @JsonProperty(value = "maintenanceWindow") - private MaintenanceWindow maintenanceWindow; + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; /* - * The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * The replication role of the server. */ - @JsonProperty(value = "sourceServerResourceId") - private String sourceServerResourceId; + @JsonProperty(value = "replicationRole") + private String replicationRole; /* - * Restore point creation time (ISO8601 format), specifying the time to - * restore from. It's required when 'createMode' is 'PointInTimeRestore'. + * The master server id of a replica server. */ - @JsonProperty(value = "pointInTimeUTC") - private OffsetDateTime pointInTimeUtc; + @JsonProperty(value = "masterServerId") + private String masterServerId; /* - * availability zone information of the server. + * The maximum number of replicas that a master server can have. */ - @JsonProperty(value = "availabilityZone") - private String availabilityZone; + @JsonProperty(value = "replicaCapacity") + private Integer replicaCapacity; /* - * The mode to create a new PostgreSQL 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 = "createMode") - private CreateMode createMode; + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; /* - * Application-specific metadata in the form of key-value pairs. + * List of private endpoint connections on a server */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) - private Map tags; + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /** Creates an instance of ServerProperties class. */ + public ServerProperties() { + } /** * Get the administratorLogin property: The administrator's login name of a server. Can only be specified when the @@ -148,274 +139,264 @@ public ServerProperties withAdministratorLogin(String administratorLogin) { } /** - * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * Get the version property: Server version. * - * @return the administratorLoginPassword value. + * @return the version value. */ - public String administratorLoginPassword() { - return this.administratorLoginPassword; + public ServerVersion version() { + return this.version; } /** - * Set the administratorLoginPassword property: The administrator login password (required for server creation). + * Set the version property: Server version. * - * @param administratorLoginPassword the administratorLoginPassword value to set. + * @param version the version value to set. * @return the ServerProperties object itself. */ - public ServerProperties withAdministratorLoginPassword(String administratorLoginPassword) { - this.administratorLoginPassword = administratorLoginPassword; + public ServerProperties withVersion(ServerVersion version) { + this.version = version; return this; } /** - * Get the version property: PostgreSQL Server version. + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @return the version value. + * @return the sslEnforcement value. */ - public ServerVersion version() { - return this.version; + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; } /** - * Set the version property: PostgreSQL Server version. + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @param version the version value to set. + * @param sslEnforcement the sslEnforcement value to set. * @return the ServerProperties object itself. */ - public ServerProperties withVersion(ServerVersion version) { - this.version = version; + public ServerProperties withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; return this; } /** - * Get the minorVersion property: The minor version of the server. + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the minorVersion value. + * @return the minimalTlsVersion value. */ - public String minorVersion() { - return this.minorVersion; + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.minimalTlsVersion; } /** - * Get the state property: A state of a server that is visible to user. + * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the state value. + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerProperties object itself. */ - public ServerState state() { - return this.state; + public ServerProperties withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; } /** - * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * Get the byokEnforcement property: Status showing whether the server data encryption is enabled with + * customer-managed keys. * - * @return the fullyQualifiedDomainName value. + * @return the byokEnforcement value. */ - public String fullyQualifiedDomainName() { - return this.fullyQualifiedDomainName; + public String byokEnforcement() { + return this.byokEnforcement; } /** - * Get the storage property: Storage properties of a server. + * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @return the storage value. + * @return the infrastructureEncryption value. */ - public Storage storage() { - return this.storage; + public InfrastructureEncryption infrastructureEncryption() { + return this.infrastructureEncryption; } /** - * Set the storage property: Storage properties of a server. + * Set the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @param storage the storage value to set. + * @param infrastructureEncryption the infrastructureEncryption value to set. * @return the ServerProperties object itself. */ - public ServerProperties withStorage(Storage storage) { - this.storage = storage; + public ServerProperties withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { + this.infrastructureEncryption = infrastructureEncryption; return this; } /** - * Get the backup property: Backup properties of a server. + * Get the userVisibleState property: A state of a server that is visible to user. * - * @return the backup value. + * @return the userVisibleState value. */ - public Backup backup() { - return this.backup; + public ServerState userVisibleState() { + return this.userVisibleState; } /** - * Set the backup property: Backup properties of a server. + * Set the userVisibleState property: A state of a server that is visible to user. * - * @param backup the backup value to set. + * @param userVisibleState the userVisibleState value to set. * @return the ServerProperties object itself. */ - public ServerProperties withBackup(Backup backup) { - this.backup = backup; + public ServerProperties withUserVisibleState(ServerState userVisibleState) { + this.userVisibleState = userVisibleState; return this; } /** - * Get the network property: Network properties of a server. + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @return the network value. + * @return the fullyQualifiedDomainName value. */ - public Network network() { - return this.network; + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; } /** - * Set the network property: Network properties of a server. + * Set the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @param network the network value to set. + * @param fullyQualifiedDomainName the fullyQualifiedDomainName value to set. * @return the ServerProperties object itself. */ - public ServerProperties withNetwork(Network network) { - this.network = network; + public ServerProperties withFullyQualifiedDomainName(String fullyQualifiedDomainName) { + this.fullyQualifiedDomainName = fullyQualifiedDomainName; return this; } /** - * Get the highAvailability property: High availability properties of a server. + * Get the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the highAvailability value. + * @return the earliestRestoreDate value. */ - public HighAvailability highAvailability() { - return this.highAvailability; + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; } /** - * Set the highAvailability property: High availability properties of a server. + * Set the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @param highAvailability the highAvailability value to set. + * @param earliestRestoreDate the earliestRestoreDate value to set. * @return the ServerProperties object itself. */ - public ServerProperties withHighAvailability(HighAvailability highAvailability) { - this.highAvailability = highAvailability; + public ServerProperties withEarliestRestoreDate(OffsetDateTime earliestRestoreDate) { + this.earliestRestoreDate = earliestRestoreDate; return this; } /** - * Get the maintenanceWindow property: Maintenance window properties of a server. + * Get the storageProfile property: Storage profile of a server. * - * @return the maintenanceWindow value. + * @return the storageProfile value. */ - public MaintenanceWindow maintenanceWindow() { - return this.maintenanceWindow; + public StorageProfile storageProfile() { + return this.storageProfile; } /** - * Set the maintenanceWindow property: Maintenance window properties of a server. + * Set the storageProfile property: Storage profile of a server. * - * @param maintenanceWindow the maintenanceWindow value to set. + * @param storageProfile the storageProfile value to set. * @return the ServerProperties object itself. */ - public ServerProperties withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; + public ServerProperties withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; return this; } /** - * Get the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * Get the replicationRole property: The replication role of the server. * - * @return the sourceServerResourceId value. + * @return the replicationRole value. */ - public String sourceServerResourceId() { - return this.sourceServerResourceId; + public String replicationRole() { + return this.replicationRole; } /** - * Set the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * Set the replicationRole property: The replication role of the server. * - * @param sourceServerResourceId the sourceServerResourceId value to set. + * @param replicationRole the replicationRole value to set. * @return the ServerProperties object itself. */ - public ServerProperties withSourceServerResourceId(String sourceServerResourceId) { - this.sourceServerResourceId = sourceServerResourceId; + public ServerProperties withReplicationRole(String replicationRole) { + this.replicationRole = replicationRole; return this; } /** - * Get the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore'. + * Get the masterServerId property: The master server id of a replica server. * - * @return the pointInTimeUtc value. + * @return the masterServerId value. */ - public OffsetDateTime pointInTimeUtc() { - return this.pointInTimeUtc; + public String masterServerId() { + return this.masterServerId; } /** - * Set the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore'. + * Set the masterServerId property: The master server id of a replica server. * - * @param pointInTimeUtc the pointInTimeUtc value to set. + * @param masterServerId the masterServerId value to set. * @return the ServerProperties object itself. */ - public ServerProperties withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { - this.pointInTimeUtc = pointInTimeUtc; + public ServerProperties withMasterServerId(String masterServerId) { + this.masterServerId = masterServerId; return this; } /** - * Get the availabilityZone property: availability zone information of the server. + * Get the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @return the availabilityZone value. + * @return the replicaCapacity value. */ - public String availabilityZone() { - return this.availabilityZone; + public Integer replicaCapacity() { + return this.replicaCapacity; } /** - * Set the availabilityZone property: availability zone information of the server. + * Set the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @param availabilityZone the availabilityZone value to set. + * @param replicaCapacity the replicaCapacity value to set. * @return the ServerProperties object itself. */ - public ServerProperties withAvailabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; + public ServerProperties withReplicaCapacity(Integer replicaCapacity) { + this.replicaCapacity = replicaCapacity; return this; } /** - * Get the createMode property: The mode to create a new PostgreSQL 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 createMode value. + * @return the publicNetworkAccess value. */ - public CreateMode createMode() { - return this.createMode; + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; } /** - * Set the createMode property: The mode to create a new PostgreSQL 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 createMode the createMode value to set. + * @param publicNetworkAccess the publicNetworkAccess value to set. * @return the ServerProperties object itself. */ - public ServerProperties withCreateMode(CreateMode createMode) { - this.createMode = createMode; + public ServerProperties withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; return this; } /** - * Get the tags property: Application-specific metadata in the form of key-value pairs. + * Get the privateEndpointConnections property: List of private endpoint connections on a server. * - * @return the tags value. + * @return the privateEndpointConnections 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 ServerProperties object itself. - */ - public ServerProperties withTags(Map tags) { - this.tags = tags; - return this; + public List privateEndpointConnections() { + return this.privateEndpointConnections; } /** @@ -424,20 +405,11 @@ public ServerProperties withTags(Map tags) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (storage() != null) { - storage().validate(); - } - if (backup() != null) { - backup().validate(); - } - if (network() != null) { - network().validate(); - } - if (highAvailability() != null) { - highAvailability().validate(); + if (storageProfile() != null) { + storageProfile().validate(); } - if (maintenanceWindow() != null) { - maintenanceWindow().validate(); + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); } } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java deleted file mode 100644 index d2f6c87bfde0..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerPropertiesForUpdate.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForUpdate; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The ServerPropertiesForUpdate model. */ -@Fluent -public final class ServerPropertiesForUpdate { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForUpdate.class); - - /* - * The password of the administrator login. - */ - @JsonProperty(value = "administratorLoginPassword") - private String administratorLoginPassword; - - /* - * Storage properties of a server. - */ - @JsonProperty(value = "storage") - private Storage storage; - - /* - * Backup properties of a server. - */ - @JsonProperty(value = "backup") - private Backup backup; - - /* - * High availability properties of a server. - */ - @JsonProperty(value = "highAvailability") - private HighAvailability highAvailability; - - /* - * Maintenance window properties of a server. - */ - @JsonProperty(value = "maintenanceWindow") - private MaintenanceWindow maintenanceWindow; - - /* - * The mode to update a new PostgreSQL server. - */ - @JsonProperty(value = "createMode") - private CreateModeForUpdate createMode; - - /** - * 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 properties of a server. - * - * @return the storage value. - */ - public Storage storage() { - return this.storage; - } - - /** - * Set the storage property: Storage 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 properties of a server. - * - * @return the backup value. - */ - public Backup backup() { - return this.backup; - } - - /** - * Set the backup property: Backup 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 properties of a server. - * - * @return the highAvailability value. - */ - public HighAvailability highAvailability() { - return this.highAvailability; - } - - /** - * Set the highAvailability property: High availability 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 properties of a server. - * - * @return the maintenanceWindow value. - */ - public MaintenanceWindow maintenanceWindow() { - return this.maintenanceWindow; - } - - /** - * Set the maintenanceWindow property: Maintenance window properties 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 createMode property: The mode to update a new PostgreSQL server. - * - * @return the createMode value. - */ - public CreateModeForUpdate createMode() { - return this.createMode; - } - - /** - * Set the createMode property: The mode to update a new PostgreSQL server. - * - * @param createMode the createMode value to set. - * @return the ServerPropertiesForUpdate object itself. - */ - public ServerPropertiesForUpdate withCreateMode(CreateModeForUpdate createMode) { - this.createMode = createMode; - 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(); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerSecurityAlertPolicyInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerSecurityAlertPolicyInner.java new file mode 100644 index 000000000000..b8e2914a345c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerSecurityAlertPolicyInner.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.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of ServerSecurityAlertPolicyInner class. */ + public ServerSecurityAlertPolicyInner() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerUpdateParametersProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerUpdateParametersProperties.java new file mode 100644 index 000000000000..96e0431f277d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerUpdateParametersProperties.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of ServerUpdateParametersProperties class. */ + public ServerUpdateParametersProperties() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkRuleInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkRuleInner.java new file mode 100644 index 000000000000..80dde2ae7565 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkRuleInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of VirtualNetworkRuleInner class. */ + public VirtualNetworkRuleInner() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkRuleProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkRuleProperties.java new file mode 100644 index 000000000000..9152b7581f58 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkRuleProperties.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.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of VirtualNetworkRuleProperties class. */ + public VirtualNetworkRuleProperties() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java deleted file mode 100644 index 17d0e45dc47c..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.DelegatedSubnetUsage; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Virtual network subnet usage data. */ -@Immutable -public final class VirtualNetworkSubnetUsageResultInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkSubnetUsageResultInner.class); - - /* - * The delegatedSubnetsUsage property. - */ - @JsonProperty(value = "delegatedSubnetsUsage", access = JsonProperty.Access.WRITE_ONLY) - private List delegatedSubnetsUsage; - - /** - * Get the delegatedSubnetsUsage property: The delegatedSubnetsUsage property. - * - * @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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java deleted file mode 100644 index 8e96f0d33c83..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.implementation; - -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilityProperties; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerEditionCapability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HyperscaleNodeEditionCapability; -import java.util.Collections; -import java.util.List; - -public final class CapabilityPropertiesImpl implements CapabilityProperties { - private CapabilityPropertiesInner innerObject; - - private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - - CapabilityPropertiesImpl( - CapabilityPropertiesInner innerObject, - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String zone() { - return this.innerModel().zone(); - } - - public Boolean geoBackupSupported() { - return this.innerModel().geoBackupSupported(); - } - - public Boolean zoneRedundantHaSupported() { - return this.innerModel().zoneRedundantHaSupported(); - } - - public Boolean zoneRedundantHaAndGeoBackupSupported() { - return this.innerModel().zoneRedundantHaAndGeoBackupSupported(); - } - - public List supportedFlexibleServerEditions() { - List inner = this.innerModel().supportedFlexibleServerEditions(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public List supportedHyperscaleNodeEditions() { - List inner = this.innerModel().supportedHyperscaleNodeEditions(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public String status() { - return this.innerModel().status(); - } - - public CapabilityPropertiesInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java index ed9b5cfdcbc8..fd02df45d8cc 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java @@ -22,7 +22,6 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.CheckNameAvailabilitiesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.NameAvailabilityInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.NameAvailabilityRequest; @@ -30,8 +29,6 @@ /** An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. */ public final class CheckNameAvailabilitiesClientImpl implements CheckNameAvailabilitiesClient { - private final ClientLogger logger = new ClientLogger(CheckNameAvailabilitiesClientImpl.class); - /** The proxy service used to perform REST calls. */ private final CheckNameAvailabilitiesService service; @@ -56,7 +53,7 @@ public final class CheckNameAvailabilitiesClientImpl implements CheckNameAvailab */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface CheckNameAvailabilitiesService { + public interface CheckNameAvailabilitiesService { @Headers({"Content-Type: application/json"}) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability") @ExpectedResponses({200}) @@ -77,7 +74,8 @@ Mono> execute( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @return represents a resource name availability along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> executeWithResponseAsync( @@ -101,6 +99,7 @@ private Mono> executeWithResponseAsync( } else { nameAvailabilityRequest.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -108,7 +107,7 @@ private Mono> executeWithResponseAsync( service .execute( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), nameAvailabilityRequest, accept, @@ -124,7 +123,8 @@ private Mono> executeWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @return represents a resource name availability along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> executeWithResponseAsync( @@ -148,12 +148,13 @@ 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(), nameAvailabilityRequest, accept, @@ -167,48 +168,40 @@ private Mono> executeWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @return represents a resource name availability on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono executeAsync(NameAvailabilityRequest nameAvailabilityRequest) { - return executeWithResponseAsync(nameAvailabilityRequest) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return executeWithResponseAsync(nameAvailabilityRequest).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Check the availability of name for resource. * * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a resource name availability. + * @return represents a resource name availability along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest) { - return executeAsync(nameAvailabilityRequest).block(); + public Response executeWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context) { + return executeWithResponseAsync(nameAvailabilityRequest, context).block(); } /** * Check the availability of name for resource. * * @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. * @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 Response executeWithResponse( - NameAvailabilityRequest nameAvailabilityRequest, Context context) { - return executeWithResponseAsync(nameAvailabilityRequest, context).block(); + public NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest) { + return executeWithResponse(nameAvailabilityRequest, Context.NONE).getValue(); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java index 1e167d912a45..7cb164f9b7bc 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesImpl.java @@ -13,10 +13,9 @@ import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilities; import com.azure.resourcemanager.postgresqlflexibleserver.models.NameAvailability; import com.azure.resourcemanager.postgresqlflexibleserver.models.NameAvailabilityRequest; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class CheckNameAvailabilitiesImpl implements CheckNameAvailabilities { - @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilitiesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailabilitiesImpl.class); private final CheckNameAvailabilitiesClient innerClient; @@ -29,15 +28,6 @@ public CheckNameAvailabilitiesImpl( this.serviceManager = serviceManager; } - public NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest) { - NameAvailabilityInner inner = this.serviceClient().execute(nameAvailabilityRequest); - if (inner != null) { - return new NameAvailabilityImpl(inner, this.manager()); - } else { - return null; - } - } - public Response executeWithResponse( NameAvailabilityRequest nameAvailabilityRequest, Context context) { Response inner = @@ -53,6 +43,15 @@ public Response executeWithResponse( } } + public NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest) { + NameAvailabilityInner inner = this.serviceClient().execute(nameAvailabilityRequest); + if (inner != null) { + return new NameAvailabilityImpl(inner, this.manager()); + } else { + return null; + } + } + private CheckNameAvailabilitiesClient serviceClient() { return this.innerClient; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationImpl.java index 8ce9221d4cee..47c60c431795 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationImpl.java @@ -4,11 +4,9 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationDataType; public final class ConfigurationImpl implements Configuration, Configuration.Definition, Configuration.Update { private ConfigurationInner innerObject; @@ -27,10 +25,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String value() { return this.innerModel().value(); } @@ -43,7 +37,7 @@ public String defaultValue() { return this.innerModel().defaultValue(); } - public ConfigurationDataType dataType() { + public String dataType() { return this.innerModel().dataType(); } @@ -55,6 +49,10 @@ public String source() { return this.innerModel().source(); } + public String resourceGroupName() { + return resourceGroupName; + } + public ConfigurationInner innerModel() { return this.innerObject; } @@ -69,7 +67,7 @@ private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager man private String configurationName; - public ConfigurationImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + public ConfigurationImpl withExistingServer(String resourceGroupName, String serverName) { this.resourceGroupName = resourceGroupName; this.serverName = serverName; return this; @@ -80,7 +78,7 @@ public Configuration create() { serviceManager .serviceClient() .getConfigurations() - .put(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); return this; } @@ -89,7 +87,7 @@ public Configuration create(Context context) { serviceManager .serviceClient() .getConfigurations() - .put(resourceGroupName, serverName, configurationName, this.innerModel(), context); + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), context); return this; } @@ -109,7 +107,7 @@ public Configuration apply() { serviceManager .serviceClient() .getConfigurations() - .update(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); return this; } @@ -118,7 +116,7 @@ public Configuration apply(Context context) { serviceManager .serviceClient() .getConfigurations() - .update(resourceGroupName, serverName, configurationName, this.innerModel(), context); + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), context); return this; } @@ -128,7 +126,7 @@ public Configuration 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.configurationName = Utils.getValueFromIdByName(innerObject.id(), "configurations"); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationListResultImpl.java similarity index 55% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationListResultImpl.java index e1dd51913272..732b8eb6a1b1 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationListResultImpl.java @@ -4,34 +4,41 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.DelegatedSubnetUsage; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageResult; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationListResult; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; -public final class VirtualNetworkSubnetUsageResultImpl implements VirtualNetworkSubnetUsageResult { - private VirtualNetworkSubnetUsageResultInner innerObject; +public final class ConfigurationListResultImpl implements ConfigurationListResult { + private ConfigurationListResultInner innerObject; private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - VirtualNetworkSubnetUsageResultImpl( - VirtualNetworkSubnetUsageResultInner innerObject, + ConfigurationListResultImpl( + ConfigurationListResultInner innerObject, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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); + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ConfigurationImpl(inner1, this.manager())) + .collect(Collectors.toList())); } else { return Collections.emptyList(); } } - public VirtualNetworkSubnetUsageResultInner innerModel() { + public ConfigurationListResultInner innerModel() { return this.innerObject; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsClientImpl.java index 0c2b3fdb9302..974d43fc3411 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsClientImpl.java @@ -11,7 +11,6 @@ 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; @@ -29,20 +28,17 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ConfigurationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationListResult; +import com.azure.resourcemanager.postgresqlflexibleserver.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 ConfigurationsClient. */ public final class ConfigurationsClientImpl implements ConfigurationsClient { - private final ClientLogger logger = new ClientLogger(ConfigurationsClientImpl.class); - /** The proxy service used to perform REST calls. */ private final ConfigurationsService service; @@ -66,26 +62,28 @@ public final class ConfigurationsClientImpl implements ConfigurationsClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ConfigurationsService { + public interface ConfigurationsService { @Headers({"Content-Type: application/json"}) - @Get( + @Put( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/configurations") - @ExpectedResponses({200}) + + "/servers/{serverName}/configurations/{configurationName}") + @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByServer( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") ConfigurationInner parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/configurations/{configurationName}") + + "/servers/{serverName}/configurations/{configurationName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -99,392 +97,19 @@ Mono> get( Context context); @Headers({"Content-Type: application/json"}) - @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/configurations/{configurationName}") - @ExpectedResponses({200, 202}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> update( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("serverName") String serverName, - @PathParam("configurationName") String configurationName, - @BodyParam("application/json") ConfigurationInner parameters, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Put( + @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/configurations/{configurationName}") - @ExpectedResponses({200, 202}) + + "/servers/{serverName}/configurations") + @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> put( + Mono> listByServer( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, - @PathParam("configurationName") String configurationName, - @BodyParam("application/json") ConfigurationInner 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); - } - - /** - * 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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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) - private Mono> listByServerSinglePageAsync( - String resourceGroupName, String serverName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .listByServer( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List all the 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 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) - private Mono> listByServerSinglePageAsync( - String resourceGroupName, String serverName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByServer( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } - - /** - * List all the 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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName), - nextLink -> listByServerNextSinglePageAsync(nextLink)); - } - - /** - * 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 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.COLLECTION) - private PagedFlux listByServerAsync( - String resourceGroupName, String serverName, Context context) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), - nextLink -> listByServerNextSinglePageAsync(nextLink, context)); - } - - /** - * 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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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.COLLECTION) - public PagedIterable listByServer(String resourceGroupName, String serverName) { - return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); - } - - /** - * 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 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.COLLECTION) - public PagedIterable listByServer( - String resourceGroupName, String serverName, Context context) { - return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); - } - - /** - * 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 configurationName The name of the 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 information about a configuration of server. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync( - String resourceGroupName, String serverName, String configurationName) { - 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 (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .get( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - configurationName, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * 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 configurationName The name of the 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 information about a configuration of server. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync( - String resourceGroupName, String serverName, String configurationName, 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 (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .get( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - configurationName, - accept, - context); - } - - /** - * 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 configurationName The name of the 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 information about a configuration of server. - */ - @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(); - } - }); - } - - /** - * 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 configurationName The name of the 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 information about a configuration of server. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner get(String resourceGroupName, String serverName, String configurationName) { - return getAsync(resourceGroupName, serverName, configurationName).block(); - } - - /** - * 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 configurationName The name of the 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 information about a configuration of server. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse( - String resourceGroupName, String serverName, String configurationName, Context context) { - return getWithResponseAsync(resourceGroupName, serverName, configurationName, context).block(); } /** @@ -497,10 +122,10 @@ public Response getWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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 @@ -530,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, @@ -559,10 +185,10 @@ private Mono>> updateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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, @@ -596,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, @@ -621,17 +248,21 @@ private Mono>> updateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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( - mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, Context.NONE); + mono, + this.client.getHttpPipeline(), + ConfigurationInner.class, + ConfigurationInner.class, + this.client.getContext()); } /** @@ -645,10 +276,10 @@ private PollerFlux, ConfigurationInner> beginUpda * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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, @@ -656,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( @@ -673,12 +304,12 @@ private PollerFlux, ConfigurationInner> beginUpda * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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(); } /** @@ -692,16 +323,17 @@ public SyncPoller, ConfigurationInner> beginUpdat * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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(); } /** @@ -714,12 +346,12 @@ public SyncPoller, ConfigurationInner> beginUpdat * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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); } @@ -735,16 +367,16 @@ private Mono updateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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); } @@ -762,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(); } /** @@ -781,30 +413,30 @@ 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(); } /** - * Updates a configuration of a 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 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 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. + * @return information about a configuration of server along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> putWithResponseAsync( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String configurationName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -828,49 +460,40 @@ private Mono>> putWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter configurationName 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 - .put( + .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, configurationName, - parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Updates a configuration of a 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 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 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. + * @return information about a configuration of server along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> putWithResponseAsync( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String configurationName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -894,273 +517,239 @@ private Mono>> putWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter configurationName 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 - .put( + .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, configurationName, - parameters, accept, context); } /** - * Updates a configuration of a 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 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 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. + * @return information about a configuration of server on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ConfigurationInner> beginPutAsync( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - Mono>> mono = - putWithResponseAsync(resourceGroupName, serverName, configurationName, parameters); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, Context.NONE); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String configurationName) { + return getWithResponseAsync(resourceGroupName, serverName, configurationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Updates a configuration of a 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 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 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. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ConfigurationInner> beginPutAsync( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = - putWithResponseAsync(resourceGroupName, serverName, configurationName, parameters, context); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, context); - } - - /** - * 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 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. + * @return information about a configuration of server along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ConfigurationInner> beginPut( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return beginPutAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, configurationName, context).block(); } /** - * Updates a configuration of a 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 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 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. + * @return information about a configuration of server. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ConfigurationInner> beginPut( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - return beginPutAsync(resourceGroupName, serverName, configurationName, parameters, context).getSyncPoller(); + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner get(String resourceGroupName, String serverName, String configurationName) { + return getWithResponse(resourceGroupName, serverName, configurationName, Context.NONE).getValue(); } /** - * Updates a configuration of a 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 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 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. + * @return a list of server configurations along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putAsync( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return beginPutAsync(resourceGroupName, serverName, configurationName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + 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())); } /** - * Updates a configuration of a 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 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 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. + * @return a list of server configurations along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putAsync( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - return beginPutAsync(resourceGroupName, serverName, configurationName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); + 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)); } /** - * Updates a configuration of a 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 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 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. + * @return a list of server configurations as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner put( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return putAsync(resourceGroupName, serverName, configurationName, parameters).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** - * Updates a configuration of a 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 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 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. + * @return a list of server configurations as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner put( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - return putAsync(resourceGroupName, serverName, configurationName, parameters, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** - * Get the next page of items. + * List all the configurations in a given server. * - * @param nextLink The nextLink parameter. + * @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 configurations. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ - @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())); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); } /** - * Get the next page of items. + * List all the configurations in a given server. * - * @param nextLink The nextLink parameter. + * @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 configurations. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsImpl.java index d8aa4ce2d74a..43994c328c95 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsImpl.java @@ -13,10 +13,9 @@ import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; import com.azure.resourcemanager.postgresqlflexibleserver.models.Configurations; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ConfigurationsImpl implements Configurations { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ConfigurationsImpl.class); private final ConfigurationsClient innerClient; @@ -29,26 +28,6 @@ public ConfigurationsImpl( this.serviceManager = serviceManager; } - public PagedIterable listByServer(String resourceGroupName, String serverName) { - PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(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 ConfigurationImpl(inner1, this.manager())); - } - - public Configuration get(String resourceGroupName, String serverName, String configurationName) { - ConfigurationInner inner = this.serviceClient().get(resourceGroupName, serverName, configurationName); - if (inner != null) { - return new ConfigurationImpl(inner, this.manager()); - } else { - return null; - } - } - public Response getWithResponse( String resourceGroupName, String serverName, String configurationName, Context context) { Response inner = @@ -64,26 +43,45 @@ public Response getWithResponse( } } + public Configuration get(String resourceGroupName, String serverName, String configurationName) { + ConfigurationInner inner = this.serviceClient().get(resourceGroupName, serverName, configurationName); + if (inner != null) { + return new ConfigurationImpl(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())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + 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 + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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 configurationName = Utils.getValueFromIdByName(id, "configurations"); if (configurationName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String @@ -95,23 +93,22 @@ public Configuration getById(String id) { public Response getByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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 configurationName = Utils.getValueFromIdByName(id, "configurations"); if (configurationName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabaseImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabaseImpl.java index 884c03f4565a..0d9941f7bbf0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabaseImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabaseImpl.java @@ -4,23 +4,15 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.DatabaseInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.Database; -public final class DatabaseImpl implements Database, Database.Definition { +public final class DatabaseImpl implements Database, Database.Definition, Database.Update { private DatabaseInner innerObject; private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - DatabaseImpl( - DatabaseInner innerObject, - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - public String id() { return this.innerModel().id(); } @@ -33,10 +25,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String charset() { return this.innerModel().charset(); } @@ -45,6 +33,10 @@ public String collation() { return this.innerModel().collation(); } + public String resourceGroupName() { + return resourceGroupName; + } + public DatabaseInner innerModel() { return this.innerObject; } @@ -59,7 +51,7 @@ private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager man 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; @@ -70,7 +62,7 @@ public Database create() { serviceManager .serviceClient() .getDatabases() - .create(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); return this; } @@ -79,7 +71,7 @@ public Database create(Context context) { serviceManager .serviceClient() .getDatabases() - .create(resourceGroupName, serverName, databaseName, this.innerModel(), context); + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), context); return this; } @@ -89,6 +81,38 @@ public Database create(Context context) { this.databaseName = name; } + public DatabaseImpl update() { + return this; + } + + public Database apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public Database apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), context); + return this; + } + + DatabaseImpl( + DatabaseInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + public Database refresh() { this.innerObject = serviceManager diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesClientImpl.java index 9c71fc25ea58..8020e0e01d81 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesClientImpl.java @@ -29,7 +29,6 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.DatabasesClient; @@ -41,8 +40,6 @@ /** An instance of this class provides access to all the operations defined in DatabasesClient. */ public final class DatabasesClientImpl implements DatabasesClient { - private final ClientLogger logger = new ClientLogger(DatabasesClientImpl.class); - /** The proxy service used to perform REST calls. */ private final DatabasesService service; @@ -66,14 +63,14 @@ public final class DatabasesClientImpl implements DatabasesClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface DatabasesService { + public interface DatabasesService { @Headers({"Content-Type: application/json"}) @Put( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/databases/{databaseName}") + + "/servers/{serverName}/databases/{databaseName}") @ExpectedResponses({200, 201, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> create( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -87,7 +84,7 @@ Mono>> create( @Headers({"Content-Type: application/json"}) @Delete( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/databases/{databaseName}") + + "/servers/{serverName}/databases/{databaseName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -103,7 +100,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/databases/{databaseName}") + + "/servers/{serverName}/databases/{databaseName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -119,7 +116,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/databases") + + "/servers/{serverName}/databases") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer( @@ -130,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); } /** @@ -152,10 +139,10 @@ Mono> listByServerNext( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 Database. + * @return represents a Database along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { if (this.client.getEndpoint() == null) { return Mono @@ -184,14 +171,15 @@ private Mono>> createWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .create( + .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -213,10 +201,10 @@ private Mono>> createWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 Database. + * @return represents a Database along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -245,12 +233,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( + .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -270,17 +259,21 @@ private Mono>> createWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 Database. + * @return the {@link PollerFlux} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DatabaseInner> beginCreateAsync( + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { Mono>> mono = - createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); return this .client .getLroResult( - mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, Context.NONE); + mono, + this.client.getHttpPipeline(), + DatabaseInner.class, + DatabaseInner.class, + this.client.getContext()); } /** @@ -294,14 +287,14 @@ private PollerFlux, DatabaseInner> beginCreateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 Database. + * @return the {@link PollerFlux} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DatabaseInner> beginCreateAsync( + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { context = this.client.mergeContext(context); Mono>> mono = - createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); return this .client .getLroResult( @@ -318,12 +311,12 @@ private PollerFlux, DatabaseInner> beginCreateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 Database. + * @return the {@link SyncPoller} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, DatabaseInner> beginCreate( + public SyncPoller, DatabaseInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { - return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); } /** @@ -337,12 +330,13 @@ public SyncPoller, DatabaseInner> beginCreate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 Database. + * @return the {@link SyncPoller} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, DatabaseInner> beginCreate( + public SyncPoller, DatabaseInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { - return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .getSyncPoller(); } /** @@ -355,12 +349,12 @@ public SyncPoller, DatabaseInner> beginCreate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 Database. + * @return represents a Database on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync( + private Mono createOrUpdateAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { - return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters) + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); } @@ -376,12 +370,12 @@ private Mono createAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 Database. + * @return represents a Database on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync( + private Mono createOrUpdateAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { - return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context) + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); } @@ -399,9 +393,9 @@ private Mono createAsync( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DatabaseInner create( + public DatabaseInner createOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { - return createAsync(resourceGroupName, serverName, databaseName, parameters).block(); + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).block(); } /** @@ -418,9 +412,9 @@ public DatabaseInner create( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DatabaseInner create( + public DatabaseInner createOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { - return createAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); } /** @@ -432,7 +426,7 @@ public DatabaseInner create( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -459,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( @@ -466,7 +461,7 @@ private Mono>> deleteWithResponseAsync( service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -486,7 +481,7 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -513,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, @@ -536,7 +532,7 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( @@ -544,7 +540,8 @@ private PollerFlux, Void> beginDeleteAsync( Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, databaseName); return this .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); } /** @@ -557,7 +554,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( @@ -579,7 +576,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( @@ -597,7 +594,7 @@ public SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( @@ -614,7 +611,7 @@ public SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String serverName, String databaseName) { @@ -633,7 +630,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String serverName, String databaseName, Context context) { @@ -682,7 +679,7 @@ public void delete(String resourceGroupName, String serverName, String databaseN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 database. + * @return information about a database along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -709,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( @@ -716,7 +714,7 @@ private Mono> getWithResponseAsync( service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -736,7 +734,7 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 database. + * @return information about a database along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -763,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, @@ -786,19 +785,12 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 database. + * @return information about a database on successful completion of {@link Mono}. */ @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())); } /** @@ -807,14 +799,16 @@ private Mono getAsync(String resourceGroupName, String serverName * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @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 information about a database. + * @return information about a database along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { - return getAsync(resourceGroupName, serverName, databaseName).block(); + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); } /** @@ -823,16 +817,14 @@ public DatabaseInner get(String resourceGroupName, String serverName, String dat * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @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 information about a database. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse( - String resourceGroupName, String serverName, String databaseName, Context context) { - return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); } /** @@ -843,7 +835,7 @@ public Response getWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @return a List of databases along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync( @@ -867,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( @@ -874,7 +867,7 @@ private Mono> listByServerSinglePageAsync( service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -883,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())); } @@ -901,7 +889,7 @@ 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 databases. + * @return a List of databases along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync( @@ -925,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, @@ -939,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)); } /** @@ -955,13 +939,11 @@ 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 databases. + * @return a List of databases 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)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** @@ -973,13 +955,11 @@ private PagedFlux listByServerAsync(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @return a List of databases 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)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** @@ -990,7 +970,7 @@ private PagedFlux listByServerAsync(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @return a List of databases as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -1006,81 +986,10 @@ public PagedIterable listByServer(String resourceGroupName, Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @return a List of databases 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 databases. - */ - @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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesImpl.java index 3f10147665bb..156debe11263 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesImpl.java @@ -13,10 +13,9 @@ import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.DatabaseInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.Database; import com.azure.resourcemanager.postgresqlflexibleserver.models.Databases; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class DatabasesImpl implements Databases { - @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabasesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(DatabasesImpl.class); private final DatabasesClient innerClient; @@ -37,15 +36,6 @@ public void delete(String resourceGroupName, String serverName, String databaseN this.serviceClient().delete(resourceGroupName, serverName, databaseName, context); } - public Database get(String resourceGroupName, String serverName, String databaseName) { - DatabaseInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); - if (inner != null) { - return new DatabaseImpl(inner, this.manager()); - } else { - return null; - } - } - public Response getWithResponse( String resourceGroupName, String serverName, String databaseName, Context context) { Response inner = @@ -61,6 +51,15 @@ public Response getWithResponse( } } + public Database get(String resourceGroupName, String serverName, String databaseName) { + DatabaseInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseImpl(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 DatabaseImpl(inner1, this.manager())); @@ -74,23 +73,22 @@ public PagedIterable listByServer(String resourceGroupName, String ser public Database getById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); @@ -101,23 +99,22 @@ public Database getById(String id) { public Response getByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); @@ -128,23 +125,22 @@ public Response getByIdWithResponse(String id, Context context) { public void deleteById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); @@ -155,23 +151,22 @@ public void deleteById(String id) { public void deleteByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRuleImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRuleImpl.java index 9ba449c88def..f352fcc9e7c2 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRuleImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRuleImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FirewallRuleInner; import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager man 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; @@ -110,7 +109,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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesClientImpl.java index 15b38a4148d8..065a5298bcde 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesClientImpl.java @@ -29,7 +29,6 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.FirewallRulesClient; @@ -41,8 +40,6 @@ /** An instance of this class provides access to all the operations defined in FirewallRulesClient. */ public final class FirewallRulesClientImpl implements FirewallRulesClient { - private final ClientLogger logger = new ClientLogger(FirewallRulesClientImpl.class); - /** The proxy service used to perform REST calls. */ private final FirewallRulesService service; @@ -66,11 +63,11 @@ public final class FirewallRulesClientImpl implements FirewallRulesClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface FirewallRulesService { + public interface FirewallRulesService { @Headers({"Content-Type: application/json"}) @Put( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + + "/servers/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({200, 201, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate( @@ -87,7 +84,7 @@ Mono>> createOrUpdate( @Headers({"Content-Type: application/json"}) @Delete( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + + "/servers/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -103,7 +100,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + + "/servers/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -119,7 +116,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/firewallRules") + + "/servers/{serverName}/firewallRules") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer( @@ -130,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); } /** @@ -152,7 +139,7 @@ Mono> listByServerNext( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return represents a server firewall rule along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -185,6 +172,7 @@ private Mono>> createOrUpdateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -192,7 +180,7 @@ private Mono>> createOrUpdateWithResponseAsync( service .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -214,7 +202,7 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return represents a server firewall rule along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -251,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, @@ -276,7 +265,7 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return the {@link PollerFlux} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( @@ -286,7 +275,11 @@ private PollerFlux, FirewallRuleInner> beginCreate return this .client .getLroResult( - mono, this.client.getHttpPipeline(), FirewallRuleInner.class, FirewallRuleInner.class, Context.NONE); + mono, + this.client.getHttpPipeline(), + FirewallRuleInner.class, + FirewallRuleInner.class, + this.client.getContext()); } /** @@ -300,7 +293,7 @@ private PollerFlux, FirewallRuleInner> beginCreate * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return the {@link PollerFlux} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( @@ -328,7 +321,7 @@ private PollerFlux, FirewallRuleInner> beginCreate * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return the {@link SyncPoller} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( @@ -347,7 +340,7 @@ public SyncPoller, FirewallRuleInner> beginCreateO * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return the {@link SyncPoller} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( @@ -370,7 +363,7 @@ public SyncPoller, FirewallRuleInner> beginCreateO * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return represents a server firewall rule on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -391,7 +384,7 @@ private Mono createOrUpdateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return represents a server firewall rule on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -447,7 +440,7 @@ public FirewallRuleInner createOrUpdate( } /** - * Deletes a PostgreSQL server 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. @@ -455,7 +448,7 @@ public FirewallRuleInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -483,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( @@ -490,7 +484,7 @@ private Mono>> deleteWithResponseAsync( service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -501,7 +495,7 @@ private Mono>> deleteWithResponseAsync( } /** - * Deletes a PostgreSQL server 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. @@ -510,7 +504,7 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -538,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, @@ -553,7 +548,7 @@ private Mono>> deleteWithResponseAsync( } /** - * Deletes a PostgreSQL server 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. @@ -561,7 +556,7 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( @@ -570,11 +565,12 @@ private PollerFlux, Void> beginDeleteAsync( deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName); return this .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); } /** - * Deletes a PostgreSQL server 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. @@ -583,7 +579,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( @@ -597,7 +593,7 @@ private PollerFlux, Void> beginDeleteAsync( } /** - * Deletes a PostgreSQL server 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. @@ -605,7 +601,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( @@ -614,7 +610,7 @@ public SyncPoller, Void> beginDelete( } /** - * Deletes a PostgreSQL server 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. @@ -623,7 +619,7 @@ public SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( @@ -632,7 +628,7 @@ public SyncPoller, Void> beginDelete( } /** - * Deletes a PostgreSQL server 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. @@ -640,7 +636,7 @@ public SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { @@ -650,7 +646,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Stri } /** - * Deletes a PostgreSQL server 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. @@ -659,7 +655,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync( @@ -670,7 +666,7 @@ private Mono deleteAsync( } /** - * Deletes a PostgreSQL server 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. @@ -685,7 +681,7 @@ public void delete(String resourceGroupName, String serverName, String firewallR } /** - * Deletes a PostgreSQL server 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. @@ -701,7 +697,7 @@ public void delete(String resourceGroupName, String serverName, String firewallR } /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -709,7 +705,8 @@ public void delete(String resourceGroupName, String serverName, String firewallR * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return information about a server firewall rule along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -737,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( @@ -744,7 +742,7 @@ private Mono> getWithResponseAsync( service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -755,7 +753,7 @@ private Mono> getWithResponseAsync( } /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -764,7 +762,8 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return information about a server firewall rule along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -792,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, @@ -807,7 +807,7 @@ private Mono> getWithResponseAsync( } /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -815,64 +815,57 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server firewall rule. + * @return information about a server firewall rule on successful completion of {@link Mono}. */ @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())); } /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param firewallRuleName The name of the server firewall 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 represents a server firewall rule. + * @return information about a server firewall rule along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { - return getAsync(resourceGroupName, serverName, firewallRuleName).block(); + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); } /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param firewallRuleName The name of the server firewall 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 represents a server firewall rule. + * @return information about a server firewall rule. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse( - String resourceGroupName, String serverName, String firewallRuleName, Context context) { - return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE).getValue(); } /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules 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 firewall rules. + * @return a list of firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync( @@ -896,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( @@ -903,7 +897,7 @@ private Mono> listByServerSinglePageAsync( service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -912,17 +906,12 @@ 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())); } /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules in a given server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -930,7 +919,7 @@ 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 firewall rules. + * @return a list of firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync( @@ -954,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, @@ -968,33 +958,26 @@ 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)); } /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules 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 firewall rules. + * @return a list of firewall rules 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)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules in a given server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1002,25 +985,23 @@ 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 firewall rules. + * @return a list of firewall rules 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)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules 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 firewall rules. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -1028,7 +1009,7 @@ public PagedIterable listByServer(String resourceGroupName, S } /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules in a given server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -1036,81 +1017,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 firewall rules. + * @return a list of firewall rules 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 firewall rules. - */ - @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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesImpl.java index 16cc0410c719..609a96f2efdc 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesImpl.java @@ -13,10 +13,9 @@ import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FirewallRuleInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRule; import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRules; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class FirewallRulesImpl implements FirewallRules { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRulesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(FirewallRulesImpl.class); private final FirewallRulesClient innerClient; @@ -37,15 +36,6 @@ public void delete(String resourceGroupName, String serverName, String firewallR this.serviceClient().delete(resourceGroupName, serverName, firewallRuleName, context); } - public FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName) { - FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, firewallRuleName); - if (inner != null) { - return new FirewallRuleImpl(inner, this.manager()); - } else { - return null; - } - } - public Response getWithResponse( String resourceGroupName, String serverName, String firewallRuleName, Context context) { Response inner = @@ -61,6 +51,15 @@ public Response getWithResponse( } } + public FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, firewallRuleName); + if (inner != null) { + return new FirewallRuleImpl(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 FirewallRuleImpl(inner1, this.manager())); @@ -75,23 +74,22 @@ public PagedIterable listByServer(String resourceGroupName, String public FirewallRule getById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); @@ -102,23 +100,22 @@ public FirewallRule getById(String id) { public Response getByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); @@ -129,23 +126,22 @@ public Response getByIdWithResponse(String id, Context context) { public void deleteById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); @@ -156,23 +152,22 @@ public void deleteById(String id) { public void deleteByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java deleted file mode 100644 index f5652e288d00..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; -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 { - private final ClientLogger logger = new ClientLogger(GetPrivateDnsZoneSuffixesClientImpl.class); - - /** The proxy service used to perform REST calls. */ - private final GetPrivateDnsZoneSuffixesService service; - - /** The service client containing this operation class. */ - private final PostgreSqlManagementClientImpl client; - - /** - * Initializes an instance of GetPrivateDnsZoneSuffixesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - GetPrivateDnsZoneSuffixesClientImpl(PostgreSqlManagementClientImpl client) { - this.service = - RestProxy - .create( - GetPrivateDnsZoneSuffixesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for PostgreSqlManagementClientGetPrivateDnsZoneSuffixes to be used by the - * proxy service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "PostgreSqlManagement") - private interface GetPrivateDnsZoneSuffixesService { - @Headers({"Content-Type: application/json"}) - @Post("/providers/Microsoft.DBforPostgreSQL/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. - */ - @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. - */ - @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. - */ - @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 String 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response executeWithResponse(Context context) { - return executeWithResponseAsync(context).block(); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java deleted file mode 100644 index ff2a86e26350..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.models.GetPrivateDnsZoneSuffixes; -import com.fasterxml.jackson.annotation.JsonIgnore; - -public final class GetPrivateDnsZoneSuffixesImpl implements GetPrivateDnsZoneSuffixes { - @JsonIgnore private final ClientLogger logger = new ClientLogger(GetPrivateDnsZoneSuffixesImpl.class); - - private final GetPrivateDnsZoneSuffixesClient innerClient; - - private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - - public GetPrivateDnsZoneSuffixesImpl( - GetPrivateDnsZoneSuffixesClient innerClient, - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public String execute() { - return this.serviceClient().execute(); - } - - public Response executeWithResponse(Context context) { - return this.serviceClient().executeWithResponse(context); - } - - private GetPrivateDnsZoneSuffixesClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java deleted file mode 100644 index 98f1d34f47f2..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java +++ /dev/null @@ -1,319 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilitiesListResult; -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 { - private final ClientLogger logger = new ClientLogger(LocationBasedCapabilitiesClientImpl.class); - - /** The proxy service used to perform REST calls. */ - private final LocationBasedCapabilitiesService service; - - /** The service client containing this operation class. */ - private final PostgreSqlManagementClientImpl client; - - /** - * Initializes an instance of LocationBasedCapabilitiesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - LocationBasedCapabilitiesClientImpl(PostgreSqlManagementClientImpl client) { - this.service = - RestProxy - .create( - LocationBasedCapabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for PostgreSqlManagementClientLocationBasedCapabilities to be used by the - * proxy service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "PostgreSqlManagement") - private interface LocationBasedCapabilitiesService { - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> execute( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("locationName") String locationName, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> executeNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeSinglePageAsync(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 accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .execute( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - locationName, - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeSinglePageAsync( - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .execute( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - locationName, - accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux executeAsync(String locationName) { - return new PagedFlux<>( - () -> executeSinglePageAsync(locationName), nextLink -> executeNextSinglePageAsync(nextLink)); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux executeAsync(String locationName, Context context) { - return new PagedFlux<>( - () -> executeSinglePageAsync(locationName, context), - nextLink -> executeNextSinglePageAsync(nextLink, context)); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable execute(String locationName) { - return new PagedIterable<>(executeAsync(locationName)); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable execute(String locationName, Context context) { - return new PagedIterable<>(executeAsync(locationName, 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 location capability. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeNextSinglePageAsync(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.executeNext(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 location capability. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeNextSinglePageAsync( - 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 - .executeNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java deleted file mode 100644 index 842deaa69f84..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilityProperties; -import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedCapabilities; -import com.fasterxml.jackson.annotation.JsonIgnore; - -public final class LocationBasedCapabilitiesImpl implements LocationBasedCapabilities { - @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationBasedCapabilitiesImpl.class); - - private final LocationBasedCapabilitiesClient innerClient; - - private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - - public LocationBasedCapabilitiesImpl( - LocationBasedCapabilitiesClient innerClient, - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable execute(String locationName) { - PagedIterable inner = this.serviceClient().execute(locationName); - return Utils.mapPage(inner, inner1 -> new CapabilityPropertiesImpl(inner1, this.manager())); - } - - public PagedIterable execute(String locationName, Context context) { - PagedIterable inner = this.serviceClient().execute(locationName, context); - return Utils.mapPage(inner, inner1 -> new CapabilityPropertiesImpl(inner1, this.manager())); - } - - private LocationBasedCapabilitiesClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersClientImpl.java similarity index 58% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesClientImpl.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersClientImpl.java index 5738d4368198..d85d70df516e 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersClientImpl.java @@ -4,89 +4,88 @@ package com.azure.resourcemanager.postgresqlflexibleserver.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; 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.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierListResult; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in VirtualNetworkSubnetUsagesClient. */ -public final class VirtualNetworkSubnetUsagesClientImpl implements VirtualNetworkSubnetUsagesClient { - private final ClientLogger logger = new ClientLogger(VirtualNetworkSubnetUsagesClientImpl.class); - +/** 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 VirtualNetworkSubnetUsagesService service; + private final LocationBasedPerformanceTiersService service; /** The service client containing this operation class. */ private final PostgreSqlManagementClientImpl client; /** - * Initializes an instance of VirtualNetworkSubnetUsagesClientImpl. + * Initializes an instance of LocationBasedPerformanceTiersClientImpl. * * @param client the instance of the service client containing this operation class. */ - VirtualNetworkSubnetUsagesClientImpl(PostgreSqlManagementClientImpl client) { + LocationBasedPerformanceTiersClientImpl(PostgreSqlManagementClientImpl client) { this.service = RestProxy .create( - VirtualNetworkSubnetUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + LocationBasedPerformanceTiersService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for PostgreSqlManagementClientVirtualNetworkSubnetUsages to be used by + * The interface defining all the services for PostgreSqlManagementClientLocationBasedPerformanceTiers to be used by * the proxy service to perform REST calls. */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface VirtualNetworkSubnetUsagesService { + public interface LocationBasedPerformanceTiersService { @Headers({"Content-Type: application/json"}) - @Post( + @Get( "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}" - + "/checkVirtualNetworkSubnetUsage") + + "/performanceTiers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> execute( + Mono> list( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("locationName") String locationName, - @BodyParam("application/json") VirtualNetworkSubnetUsageParameter parameters, @HeaderParam("Accept") String accept, Context context); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or 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 virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync( - String locationName, VirtualNetworkSubnetUsageParameter parameters) { + private Mono> listSinglePageAsync(String locationName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -102,41 +101,39 @@ 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(); - } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .execute( + .list( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), locationName, - parameters, 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())); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or 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. - * @return virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { + private Mono> listSinglePageAsync( + String locationName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -152,78 +149,72 @@ 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(); - } + 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(), - this.client.getSubscriptionId(), - locationName, - parameters, - accept, - context); + .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)); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or 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 virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers as paginated response with {@link PagedFlux}. */ - @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(); - } - }); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName) { + return new PagedFlux<>(() -> listSinglePageAsync(locationName)); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or 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. - * @return virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public VirtualNetworkSubnetUsageResultInner execute( - String locationName, VirtualNetworkSubnetUsageParameter parameters) { - return executeAsync(locationName, parameters).block(); + @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)); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or 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. - * @return virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { - return executeWithResponseAsync(locationName, parameters, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName, Context context) { + return new PagedIterable<>(listAsync(locationName, context)); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersImpl.java new file mode 100644 index 000000000000..fb83e5cca6d1 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedPerformanceTiers; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public LocationBasedPerformanceTiersImpl( + LocationBasedPerformanceTiersClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFileImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFileImpl.java new file mode 100644 index 000000000000..55aae3ced93a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFileImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFile; +import java.time.OffsetDateTime; + +public final class LogFileImpl implements LogFile { + private LogFileInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + LogFileImpl( + LogFileInner innerObject, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Long sizeInKB() { + return this.innerModel().sizeInKB(); + } + + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); + } + + public OffsetDateTime lastModifiedTime() { + return this.innerModel().lastModifiedTime(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String url() { + return this.innerModel().url(); + } + + public LogFileInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesClientImpl.java new file mode 100644 index 000000000000..52d72c7bb167 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LogFilesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFileListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +public final class LogFilesClientImpl implements LogFilesClient { + /** The proxy service used to perform REST calls. */ + private final LogFilesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of LogFilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LogFilesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = RestProxy.create(LogFilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientLogFiles to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface LogFilesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesImpl.java new file mode 100644 index 000000000000..5395cb92d993 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LogFilesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFile; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFiles; + +public final class LogFilesImpl implements LogFiles { + private static final ClientLogger LOGGER = new ClientLogger(LogFilesImpl.class); + + private final LogFilesClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public LogFilesImpl( + LogFilesClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager())); + } + + private LogFilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/NameAvailabilityImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/NameAvailabilityImpl.java index 9b1cd062bde4..a51f23545ac3 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/NameAvailabilityImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/NameAvailabilityImpl.java @@ -27,12 +27,8 @@ public Boolean nameAvailable() { return this.innerModel().nameAvailable(); } - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); + public String reason() { + return this.innerModel().reason(); } public NameAvailabilityInner innerModel() { diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationListResultImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationListResultImpl.java index 772c2f4469f7..2673de87cf9d 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationListResultImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationListResultImpl.java @@ -31,10 +31,6 @@ public List value() { } } - public String nextLink() { - return this.innerModel().nextLink(); - } - public OperationListResultInner innerModel() { return this.innerObject; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsClientImpl.java index 7f72e0a9ccaa..18c258ecca48 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsClientImpl.java @@ -20,15 +20,12 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.OperationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.OperationListResultInner; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in OperationsClient. */ public final class OperationsClientImpl implements OperationsClient { - private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); - /** The proxy service used to perform REST calls. */ private final OperationsService service; @@ -52,7 +49,7 @@ public final class OperationsClientImpl implements OperationsClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface OperationsService { + public interface OperationsService { @Headers({"Content-Type: application/json"}) @Get("/providers/Microsoft.DBforPostgreSQL/operations") @ExpectedResponses({200}) @@ -69,7 +66,8 @@ Mono> list( * * @throws ManagementException 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. + * @return a list of resource provider operations along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listWithResponseAsync() { @@ -79,10 +77,10 @@ private Mono> listWithResponseAsync() { 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)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -93,7 +91,8 @@ private Mono> listWithResponseAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @return a list of resource provider operations along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listWithResponseAsync(Context context) { @@ -103,9 +102,10 @@ private Mono> listWithResponseAsync(Context c 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); + return service.list(this.client.getEndpoint(), apiVersion, accept, context); } /** @@ -113,44 +113,36 @@ private Mono> listWithResponseAsync(Context c * * @throws ManagementException 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. + * @return a list of resource provider operations on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono listAsync() { - return listWithResponseAsync() - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + 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. + * @return a list of resource provider operations along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public OperationListResultInner list() { - return listAsync().block(); + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); } /** * 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(Context context) { - return listWithResponseAsync(context).block(); + public OperationListResultInner list() { + return listWithResponse(Context.NONE).getValue(); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsImpl.java index 8c1ce19d3ae0..f57df861eceb 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsImpl.java @@ -12,10 +12,9 @@ import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.OperationListResultInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.OperationListResult; import com.azure.resourcemanager.postgresqlflexibleserver.models.Operations; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class OperationsImpl implements Operations { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); private final OperationsClient innerClient; @@ -28,15 +27,6 @@ public OperationsImpl( this.serviceManager = serviceManager; } - public OperationListResult list() { - OperationListResultInner inner = this.serviceClient().list(); - if (inner != null) { - return new OperationListResultImpl(inner, this.manager()); - } else { - return null; - } - } - public Response listWithResponse(Context context) { Response inner = this.serviceClient().listWithResponse(context); if (inner != null) { @@ -50,6 +40,15 @@ public Response listWithResponse(Context context) { } } + public OperationListResult list() { + OperationListResultInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + private OperationsClient serviceClient() { return this.innerClient; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PerformanceTierPropertiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PerformanceTierPropertiesImpl.java new file mode 100644 index 000000000000..6490cea55fd8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierProperties; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierServiceLevelObjectives; +import java.util.Collections; +import java.util.List; + +public final class PerformanceTierPropertiesImpl implements PerformanceTierProperties { + private PerformanceTierPropertiesInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + PerformanceTierPropertiesImpl( + PerformanceTierPropertiesInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientBuilder.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientBuilder.java index 52ec4fea37ed..3dbbce584382 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientBuilder.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientBuilder.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 PostgreSqlManagementClientBuilder environment(AzureEnvironment environmen } /* - * 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 PostgreSqlManagementClientBuilder. */ - public PostgreSqlManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; + public PostgreSqlManagementClientBuilder 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 PostgreSqlManagementClientBuilder. */ - public PostgreSqlManagementClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; + public PostgreSqlManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; return this; } @@ -120,27 +119,26 @@ public PostgreSqlManagementClientBuilder serializerAdapter(SerializerAdapter ser * @return an instance of PostgreSqlManagementClientImpl. */ public PostgreSqlManagementClientImpl buildClient() { - if (endpoint == null) { - this.endpoint = "https://management.azure.com"; - } - if (environment == null) { - this.environment = AzureEnvironment.AZURE; - } - 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(); - } + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); PostgreSqlManagementClientImpl client = new PostgreSqlManagementClientImpl( - pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); return client; } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java index d204ecc2f2bb..636150e82d34 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java @@ -15,6 +15,7 @@ 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; @@ -25,27 +26,33 @@ import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ConfigurationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.DatabasesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.FirewallRulesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LogFilesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.OperationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PostgreSqlManagementClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.RecoverableServersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerAdministratorsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerKeysClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerParametersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerSecurityAlertPoliciesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServersClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkRulesClient; 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; /** Initializes a new instance of the PostgreSqlManagementClientImpl type. */ @ServiceClient(builder = PostgreSqlManagementClientBuilder.class) public final class PostgreSqlManagementClientImpl implements PostgreSqlManagementClient { - private final ClientLogger logger = new ClientLogger(PostgreSqlManagementClientImpl.class); - /** The ID of the target subscription. */ private final String subscriptionId; @@ -70,18 +77,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; @@ -130,6 +125,18 @@ public ServersClient getServers() { return this.servers; } + /** The ReplicasClient object to access its operations. */ + private final ReplicasClient replicas; + + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + public ReplicasClient getReplicas() { + return this.replicas; + } + /** The FirewallRulesClient object to access its operations. */ private final FirewallRulesClient firewallRules; @@ -142,6 +149,30 @@ 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; + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + public DatabasesClient getDatabases() { + return this.databases; + } + /** The ConfigurationsClient object to access its operations. */ private final ConfigurationsClient configurations; @@ -154,40 +185,88 @@ public ConfigurationsClient getConfigurations() { return this.configurations; } - /** The CheckNameAvailabilitiesClient object to access its operations. */ - private final CheckNameAvailabilitiesClient checkNameAvailabilities; + /** The ServerParametersClient object to access its operations. */ + private final ServerParametersClient serverParameters; /** - * Gets the CheckNameAvailabilitiesClient object to access its operations. + * Gets the ServerParametersClient object to access its operations. * - * @return the CheckNameAvailabilitiesClient object. + * @return the ServerParametersClient object. */ - public CheckNameAvailabilitiesClient getCheckNameAvailabilities() { - return this.checkNameAvailabilities; + public ServerParametersClient getServerParameters() { + return this.serverParameters; } - /** The LocationBasedCapabilitiesClient object to access its operations. */ - private final LocationBasedCapabilitiesClient locationBasedCapabilities; + /** The LogFilesClient object to access its operations. */ + private final LogFilesClient logFiles; /** - * Gets the LocationBasedCapabilitiesClient object to access its operations. + * Gets the LogFilesClient object to access its operations. * - * @return the LocationBasedCapabilitiesClient object. + * @return the LogFilesClient object. */ - public LocationBasedCapabilitiesClient getLocationBasedCapabilities() { - return this.locationBasedCapabilities; + public LogFilesClient getLogFiles() { + return this.logFiles; } - /** The VirtualNetworkSubnetUsagesClient object to access its operations. */ - private final VirtualNetworkSubnetUsagesClient virtualNetworkSubnetUsages; + /** The ServerAdministratorsClient object to access its operations. */ + private final ServerAdministratorsClient serverAdministrators; /** - * Gets the VirtualNetworkSubnetUsagesClient object to access its operations. + * Gets the ServerAdministratorsClient object to access its operations. * - * @return the VirtualNetworkSubnetUsagesClient object. + * @return the ServerAdministratorsClient object. */ - public VirtualNetworkSubnetUsagesClient getVirtualNetworkSubnetUsages() { - return this.virtualNetworkSubnetUsages; + public ServerAdministratorsClient getServerAdministrators() { + return this.serverAdministrators; + } + + /** The RecoverableServersClient object to access its operations. */ + private final RecoverableServersClient recoverableServers; + + /** + * Gets the RecoverableServersClient object to access its operations. + * + * @return the RecoverableServersClient object. + */ + 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. */ @@ -202,28 +281,52 @@ public OperationsClient getOperations() { return this.operations; } - /** The DatabasesClient object to access its operations. */ - private final DatabasesClient databases; + /** The ServerSecurityAlertPoliciesClient object to access its operations. */ + private final ServerSecurityAlertPoliciesClient serverSecurityAlertPolicies; /** - * Gets the DatabasesClient object to access its operations. + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. * - * @return the DatabasesClient object. + * @return the ServerSecurityAlertPoliciesClient object. */ - public DatabasesClient getDatabases() { - return this.databases; + public ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies() { + return this.serverSecurityAlertPolicies; + } + + /** 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 GetPrivateDnsZoneSuffixesClient object to access its operations. */ - private final GetPrivateDnsZoneSuffixesClient getPrivateDnsZoneSuffixes; + /** The PrivateLinkResourcesClient object to access its operations. */ + private final PrivateLinkResourcesClient privateLinkResources; /** - * Gets the GetPrivateDnsZoneSuffixesClient object to access its operations. + * Gets the PrivateLinkResourcesClient object to access its operations. * - * @return the GetPrivateDnsZoneSuffixesClient object. + * @return the PrivateLinkResourcesClient object. */ - public GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes() { - return this.getPrivateDnsZoneSuffixes; + 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; } /** @@ -248,16 +351,24 @@ public GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-06-01"; this.servers = new ServersClientImpl(this); + this.replicas = new ReplicasClientImpl(this); this.firewallRules = new FirewallRulesClientImpl(this); + this.virtualNetworkRules = new VirtualNetworkRulesClientImpl(this); + this.databases = new DatabasesClientImpl(this); this.configurations = new ConfigurationsClientImpl(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.locationBasedCapabilities = new LocationBasedCapabilitiesClientImpl(this); - this.virtualNetworkSubnetUsages = new VirtualNetworkSubnetUsagesClientImpl(this); this.operations = new OperationsClientImpl(this); - this.databases = new DatabasesClientImpl(this); - this.getPrivateDnsZoneSuffixes = new GetPrivateDnsZoneSuffixesClientImpl(this); + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.serverKeys = new ServerKeysClientImpl(this); } /** @@ -276,10 +387,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); } /** @@ -343,7 +451,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, managementError = null; } } catch (IOException | RuntimeException ioe) { - logger.logThrowableAsWarning(ioe); + LOGGER.logThrowableAsWarning(ioe); } } } else { @@ -402,4 +510,6 @@ public Mono getBodyAsString(Charset charset) { return Mono.just(new String(responseBody, charset)); } } + + private static final ClientLogger LOGGER = new ClientLogger(PostgreSqlManagementClientImpl.class); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..c61f71d48f65 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; +import com.azure.resourcemanager.postgresqlflexibleserver.models.TagsObject; +import java.util.Map; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public 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.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..b9e82f0bd47d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1530 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnectionListResult; +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientPrivateEndpointConnections to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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. + * @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(); + } + + /** + * 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 getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE).getValue(); + } + + /** + * 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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 tags on private endpoint connection. + * + *

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 URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..acf90b86e9a0 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourceImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 000000000000..bc427a2f007a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..efabd69d7ffc --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientPrivateLinkResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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(); + } + + /** + * Gets a private link resource for PostgreSQL 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 PostgreSQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName) { + return getWithResponse(resourceGroupName, serverName, groupName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..b6ca6ee56503 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResource; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new 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 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; + } + } + + 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; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServerResourceImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServerResourceImpl.java new file mode 100644 index 000000000000..dad4170fa079 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RecoverableServerResource; + +public final class RecoverableServerResourceImpl implements RecoverableServerResource { + private RecoverableServerResourceInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + RecoverableServerResourceImpl( + RecoverableServerResourceInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersClientImpl.java new file mode 100644 index 000000000000..2c54b70994ff --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.RecoverableServersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoverableServersClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(RecoverableServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientRecoverableServers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface RecoverableServersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Gets a recoverable PostgreSQL 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 PostgreSQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoverableServerResourceInner get(String resourceGroupName, String serverName) { + return getWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersImpl.java similarity index 50% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesImpl.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersImpl.java index 591f4589f95a..c0efddf011e1 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersImpl.java @@ -8,52 +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.postgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageResult; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsages; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.RecoverableServersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RecoverableServerResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RecoverableServers; -public final class VirtualNetworkSubnetUsagesImpl implements VirtualNetworkSubnetUsages { - @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkSubnetUsagesImpl.class); +public final class RecoverableServersImpl implements RecoverableServers { + private static final ClientLogger LOGGER = new ClientLogger(RecoverableServersImpl.class); - private final VirtualNetworkSubnetUsagesClient innerClient; + private final RecoverableServersClient innerClient; private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - public VirtualNetworkSubnetUsagesImpl( - VirtualNetworkSubnetUsagesClient innerClient, + public RecoverableServersImpl( + RecoverableServersClient innerClient, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } - public VirtualNetworkSubnetUsageResult execute(String locationName, VirtualNetworkSubnetUsageParameter parameters) { - VirtualNetworkSubnetUsageResultInner inner = this.serviceClient().execute(locationName, parameters); + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); if (inner != null) { - return new VirtualNetworkSubnetUsageResultImpl(inner, this.manager()); + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecoverableServerResourceImpl(inner.getValue(), this.manager())); } else { return null; } } - public Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { - Response inner = - this.serviceClient().executeWithResponse(locationName, parameters, context); + public RecoverableServerResource get(String resourceGroupName, String serverName) { + RecoverableServerResourceInner inner = this.serviceClient().get(resourceGroupName, serverName); if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new VirtualNetworkSubnetUsageResultImpl(inner.getValue(), this.manager())); + return new RecoverableServerResourceImpl(inner, this.manager()); } else { return null; } } - private VirtualNetworkSubnetUsagesClient serviceClient() { + private RecoverableServersClient serviceClient() { return this.innerClient; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasClientImpl.java new file mode 100644 index 000000000000..3b59403bf987 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasClientImpl.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.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReplicasClient. */ +public final class ReplicasClientImpl implements ReplicasClient { + /** The proxy service used to perform REST calls. */ + private final ReplicasService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ReplicasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReplicasClientImpl(PostgreSqlManagementClientImpl client) { + this.service = RestProxy.create(ReplicasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientReplicas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ReplicasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/replicas") + @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 replicas for 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 servers 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 replicas for 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 servers 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 replicas for 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 servers 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 replicas for 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 servers 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 replicas for 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 servers 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 replicas for 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 servers 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasImpl.java new file mode 100644 index 000000000000..f5cb2cf2a1ee --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Replicas; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; + +public final class ReplicasImpl implements Replicas { + private static final ClientLogger LOGGER = new ClientLogger(ReplicasImpl.class); + + private final ReplicasClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ReplicasImpl( + ReplicasClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerImpl(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 ServerImpl(inner1, this.manager())); + } + + private ReplicasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorResourceImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorResourceImpl.java new file mode 100644 index 000000000000..19c4ec637ffe --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.AdministratorType; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerAdministratorResource; +import java.util.UUID; + +public final class ServerAdministratorResourceImpl implements ServerAdministratorResource { + private ServerAdministratorResourceInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + ServerAdministratorResourceImpl( + ServerAdministratorResourceInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsClientImpl.java new file mode 100644 index 000000000000..6bce47d40143 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.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.postgresqlflexibleserver.fluent.ServerAdministratorsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAdministratorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAdministratorsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerAdministratorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerAdministrators to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ServerAdministratorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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. + * @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(); + } + + /** + * 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 getWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsImpl.java new file mode 100644 index 000000000000..5e6a35d6aafb --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerAdministratorsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerAdministratorResource; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerAdministratorsImpl( + ServerAdministratorsClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersClientImpl.java new file mode 100644 index 000000000000..1b19aa7d9f47 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServerBasedPerformanceTiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerBasedPerformanceTiersClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerBasedPerformanceTiersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerBasedPerformanceTiers to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ServerBasedPerformanceTiersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersImpl.java new file mode 100644 index 000000000000..79442d175a77 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierProperties; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerBasedPerformanceTiersImpl( + ServerBasedPerformanceTiersClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java index fbbaebacb6ff..2b8e579b085b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java @@ -5,24 +5,25 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; import com.azure.core.management.Region; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForUpdate; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Network; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; +import com.azure.resourcemanager.postgresqlflexibleserver.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ResourceIdentity; import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForUpdate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForCreate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForCreate; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerState; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerUpdateParameters; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.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 { @@ -55,80 +56,76 @@ public Map tags() { } } - public Sku sku() { - return this.innerModel().sku(); + public ResourceIdentity identity() { + return this.innerModel().identity(); } - public SystemData systemData() { - return this.innerModel().systemData(); + public Sku sku() { + return this.innerModel().sku(); } public String administratorLogin() { return this.innerModel().administratorLogin(); } - public String administratorLoginPassword() { - return this.innerModel().administratorLoginPassword(); - } - public ServerVersion version() { return this.innerModel().version(); } - public String minorVersion() { - return this.innerModel().minorVersion(); + public SslEnforcementEnum sslEnforcement() { + return this.innerModel().sslEnforcement(); } - public ServerState state() { - return this.innerModel().state(); + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.innerModel().minimalTlsVersion(); } - public String fullyQualifiedDomainName() { - return this.innerModel().fullyQualifiedDomainName(); + public String byokEnforcement() { + return this.innerModel().byokEnforcement(); } - public Storage storage() { - return this.innerModel().storage(); + public InfrastructureEncryption infrastructureEncryption() { + return this.innerModel().infrastructureEncryption(); } - public Backup backup() { - return this.innerModel().backup(); + public ServerState userVisibleState() { + return this.innerModel().userVisibleState(); } - public Network network() { - return this.innerModel().network(); + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); } - public HighAvailability highAvailability() { - return this.innerModel().highAvailability(); + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); } - public MaintenanceWindow maintenanceWindow() { - return this.innerModel().maintenanceWindow(); + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); } - public String sourceServerResourceId() { - return this.innerModel().sourceServerResourceId(); + public String replicationRole() { + return this.innerModel().replicationRole(); } - public OffsetDateTime pointInTimeUtc() { - return this.innerModel().pointInTimeUtc(); + public String masterServerId() { + return this.innerModel().masterServerId(); } - public String availabilityZone() { - return this.innerModel().availabilityZone(); + public Integer replicaCapacity() { + return this.innerModel().replicaCapacity(); } - public CreateMode createMode() { - return this.innerModel().createMode(); + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); } - public Map tagsPropertiesTags() { - Map inner = this.innerModel().tagsPropertiesTags(); + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); if (inner != null) { - return Collections.unmodifiableMap(inner); + return Collections.unmodifiableList(inner); } else { - return Collections.emptyMap(); + return Collections.emptyList(); } } @@ -140,6 +137,10 @@ public String regionName() { return this.location(); } + public String resourceGroupName() { + return resourceGroupName; + } + public ServerInner innerModel() { return this.innerObject; } @@ -152,7 +153,9 @@ private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager man private String serverName; - private ServerForUpdate updateParameters; + private ServerForCreate createParameters; + + private ServerUpdateParameters updateParameters; public ServerImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; @@ -164,7 +167,7 @@ public Server create() { serviceManager .serviceClient() .getServers() - .create(resourceGroupName, serverName, this.innerModel(), Context.NONE); + .create(resourceGroupName, serverName, createParameters, Context.NONE); return this; } @@ -173,7 +176,7 @@ public Server create(Context context) { serviceManager .serviceClient() .getServers() - .create(resourceGroupName, serverName, this.innerModel(), context); + .create(resourceGroupName, serverName, createParameters, context); return this; } @@ -181,10 +184,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; } @@ -211,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() { @@ -234,151 +238,91 @@ public Server refresh(Context context) { return this; } - public void restart(RestartParameter parameters) { - serviceManager.servers().restart(resourceGroupName, serverName, parameters); - } - public void restart() { serviceManager.servers().restart(resourceGroupName, serverName); } - public void restart(RestartParameter parameters, Context context) { - serviceManager.servers().restart(resourceGroupName, serverName, parameters, context); - } - - public void start() { - serviceManager.servers().start(resourceGroupName, serverName); - } - - public void start(Context context) { - serviceManager.servers().start(resourceGroupName, serverName, context); - } - - public void stop() { - serviceManager.servers().stop(resourceGroupName, serverName); - } - - public void stop(Context context) { - serviceManager.servers().stop(resourceGroupName, serverName, context); + public void restart(Context context) { + serviceManager.servers().restart(resourceGroupName, serverName, 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); - return this; - } - - public ServerImpl withTags(Map tags) { - if (isInCreateMode()) { - this.innerModel().withTags(tags); - return this; - } else { - this.updateParameters.withTags(tags); - return this; - } - } - - public ServerImpl withSku(Sku sku) { - if (isInCreateMode()) { - this.innerModel().withSku(sku); - return this; - } else { - this.updateParameters.withSku(sku); - return this; - } - } - - public ServerImpl withAdministratorLogin(String administratorLogin) { - this.innerModel().withAdministratorLogin(administratorLogin); + this.createParameters.withLocation(location); 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); + public ServerImpl withProperties(ServerPropertiesForCreate properties) { + this.createParameters.withProperties(properties); return this; } - public ServerImpl withStorage(Storage storage) { + public ServerImpl withTags(Map tags) { if (isInCreateMode()) { - this.innerModel().withStorage(storage); + this.createParameters.withTags(tags); return this; } else { - this.updateParameters.withStorage(storage); + this.updateParameters.withTags(tags); return this; } } - public ServerImpl withBackup(Backup backup) { + public ServerImpl withIdentity(ResourceIdentity identity) { if (isInCreateMode()) { - this.innerModel().withBackup(backup); + this.createParameters.withIdentity(identity); return this; } else { - this.updateParameters.withBackup(backup); + this.updateParameters.withIdentity(identity); return this; } } - public ServerImpl withNetwork(Network network) { - this.innerModel().withNetwork(network); - return this; - } - - public ServerImpl withHighAvailability(HighAvailability highAvailability) { + public ServerImpl withSku(Sku sku) { if (isInCreateMode()) { - this.innerModel().withHighAvailability(highAvailability); + this.createParameters.withSku(sku); return this; } else { - this.updateParameters.withHighAvailability(highAvailability); + this.updateParameters.withSku(sku); return this; } } - public ServerImpl withSourceServerResourceId(String sourceServerResourceId) { - this.innerModel().withSourceServerResourceId(sourceServerResourceId); + public ServerImpl withStorageProfile(StorageProfile storageProfile) { + this.updateParameters.withStorageProfile(storageProfile); return this; } - public ServerImpl withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { - this.innerModel().withPointInTimeUtc(pointInTimeUtc); + public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); return this; } - public ServerImpl withAvailabilityZone(String availabilityZone) { - this.innerModel().withAvailabilityZone(availabilityZone); + public ServerImpl withVersion(ServerVersion version) { + this.updateParameters.withVersion(version); return this; } - public ServerImpl withCreateMode(CreateMode createMode) { - this.innerModel().withCreateMode(createMode); + public ServerImpl withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.updateParameters.withSslEnforcement(sslEnforcement); return this; } - public ServerImpl withTagsPropertiesTags(Map tagsPropertiesTags) { - this.innerModel().withTagsPropertiesTags(tagsPropertiesTags); + public ServerImpl withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.updateParameters.withMinimalTlsVersion(minimalTlsVersion); return this; } - public ServerImpl withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { - this.updateParameters.withMaintenanceWindow(maintenanceWindow); + public ServerImpl withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.updateParameters.withPublicNetworkAccess(publicNetworkAccess); return this; } - public ServerImpl withCreateMode(CreateModeForUpdate createMode) { - this.updateParameters.withCreateMode(createMode); + public ServerImpl withReplicationRole(String replicationRole) { + this.updateParameters.withReplicationRole(replicationRole); return this; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeyImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeyImpl.java new file mode 100644 index 000000000000..2012ca6cb8da --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeyImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKey; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeyType; +import java.time.OffsetDateTime; + +public final class ServerKeyImpl implements ServerKey, ServerKey.Definition, ServerKey.Update { + private ServerKeyInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String 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.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysClientImpl.java new file mode 100644 index 000000000000..49923b0a1076 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysClientImpl.java @@ -0,0 +1,1090 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.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.postgresqlflexibleserver.fluent.ServerKeysClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServerKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerKeysClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerKeys to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ServerKeysService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL 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(); + } + + /** + * Gets a PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner get(String resourceGroupName, String serverName, String keyName) { + return getWithResponse(resourceGroupName, serverName, keyName, Context.NONE).getValue(); + } + + /** + * Creates or updates a PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgreSQL 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 URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgreSQL 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysImpl.java new file mode 100644 index 000000000000..05937cbab4d4 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerKeysClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKey; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerKeysImpl( + ServerKeysClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new 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 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 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 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + public ServerKeyImpl define(String name) { + return new ServerKeyImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersClientImpl.java new file mode 100644 index 000000000000..cbb51fb25495 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerParametersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServerParametersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerParametersClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerParameters to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ServerParametersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersImpl.java new file mode 100644 index 000000000000..2480944d7d1f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerParametersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationListResult; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerParametersImpl( + ServerParametersClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesClientImpl.java new file mode 100644 index 000000000000..a55cdf713216 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,885 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.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.postgresqlflexibleserver.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServerSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerSecurityAlertPoliciesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerSecurityAlertPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerSecurityAlertPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface ServerSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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. + * @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(); + } + + /** + * 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 getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE).getValue(); + } + + /** + * 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 URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesImpl.java new file mode 100644 index 000000000000..2aaeda2a1cb3 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesImpl.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerSecurityAlertPoliciesImpl( + ServerSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + 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))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + } + + private ServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + public ServerSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new ServerSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPolicyImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPolicyImpl.java new file mode 100644 index 000000000000..1eced9c5e227 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPolicyImpl.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.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicy; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public 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.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersClientImpl.java index 08b4a3c4e247..52f9d7e6cf8a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersClientImpl.java @@ -31,22 +31,19 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServersClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForUpdate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForCreate; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerListResult; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerUpdateParameters; 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 ServersClient. */ public final class ServersClientImpl implements ServersClient { - private final ClientLogger logger = new ClientLogger(ServersClientImpl.class); - /** The proxy service used to perform REST calls. */ private final ServersService service; @@ -69,11 +66,11 @@ public final class ServersClientImpl implements ServersClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ServersService { + public interface ServersService { @Headers({"Content-Type: application/json"}) @Put( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}") + + "/servers/{serverName}") @ExpectedResponses({200, 201, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -82,14 +79,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.DBforPostgreSQL" - + "/flexibleServers/{serverName}") + + "/servers/{serverName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @@ -98,14 +95,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.DBforPostgreSQL" - + "/flexibleServers/{serverName}") + + "/servers/{serverName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -120,7 +117,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}") + + "/servers/{serverName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @@ -135,7 +132,7 @@ Mono> getByResourceGroup( @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers") + + "/servers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @@ -147,7 +144,7 @@ Mono> listByResourceGroup( Context context); @Headers({"Content-Type: application/json"}) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -160,7 +157,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Post( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/restart") + + "/servers/{serverName}/restart") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> restart( @@ -169,63 +166,12 @@ Mono>> restart( @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, - @BodyParam("application/json") RestartParameter parameters, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/start") - @ExpectedResponses({200, 202}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> start( - @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"}) - @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/flexibleServers/{serverName}/stop") - @ExpectedResponses({200, 202}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> stop( - @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, @HeaderParam("Accept") String accept, Context context); } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -233,11 +179,11 @@ Mono> listNext( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return represents a server along with {@link Response} on successful completion of {@link Mono}. */ @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( @@ -262,6 +208,7 @@ private Mono>> createWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -269,7 +216,7 @@ private Mono>> createWithResponseAsync( service .create( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -280,7 +227,7 @@ private Mono>> createWithResponseAsync( } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -289,11 +236,11 @@ private Mono>> createWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return represents a server along with {@link Response} on successful completion of {@link Mono}. */ @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( @@ -318,12 +265,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, @@ -333,7 +281,7 @@ private Mono>> createWithResponseAsync( } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -341,20 +289,20 @@ private Mono>> createWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return the {@link PollerFlux} for polling of represents a server. */ @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 .getLroResult( - mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, Context.NONE); + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, this.client.getContext()); } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -363,11 +311,11 @@ private PollerFlux, ServerInner> beginCreateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return the {@link PollerFlux} for polling of represents a server. */ @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); @@ -378,7 +326,7 @@ private PollerFlux, ServerInner> beginCreateAsync( } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -386,16 +334,16 @@ private PollerFlux, ServerInner> beginCreateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return the {@link SyncPoller} for polling of represents a server. */ @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(); } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -404,16 +352,16 @@ public SyncPoller, ServerInner> beginCreate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return the {@link SyncPoller} for polling of represents a server. */ @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(); } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -421,17 +369,17 @@ public SyncPoller, ServerInner> beginCreate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @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); } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -440,18 +388,18 @@ private Mono createAsync(String resourceGroupName, String serverNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return represents a server on successful completion of {@link Mono}. */ @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); } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -462,12 +410,12 @@ 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(); } /** - * Creates a new server. + * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -479,7 +427,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(); } @@ -493,11 +442,11 @@ public ServerInner create(String resourceGroupName, String serverName, ServerInn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return represents a server along with {@link Response} on successful completion of {@link Mono}. */ @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( @@ -522,6 +471,7 @@ private Mono>> updateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -529,7 +479,7 @@ private Mono>> updateWithResponseAsync( service .update( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -550,11 +500,11 @@ private Mono>> updateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return represents a server along with {@link Response} on successful completion of {@link Mono}. */ @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( @@ -579,12 +529,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, @@ -603,16 +554,16 @@ private Mono>> updateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return the {@link PollerFlux} for polling of represents a server. */ @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 .getLroResult( - mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, Context.NONE); + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, this.client.getContext()); } /** @@ -626,11 +577,11 @@ private PollerFlux, ServerInner> beginUpdateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return the {@link PollerFlux} for polling of represents a server. */ @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); @@ -650,11 +601,11 @@ private PollerFlux, ServerInner> beginUpdateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return the {@link SyncPoller} for polling of represents a server. */ @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(); } @@ -669,11 +620,11 @@ public SyncPoller, ServerInner> beginUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return the {@link SyncPoller} for polling of represents a server. */ @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(); } @@ -687,10 +638,11 @@ public SyncPoller, ServerInner> beginUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @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); @@ -707,11 +659,11 @@ private Mono updateAsync(String resourceGroupName, String serverNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return represents a server on successful completion of {@link Mono}. */ @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); @@ -730,7 +682,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(); } @@ -749,7 +701,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(); } @@ -761,7 +713,7 @@ public ServerInner update( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName) { @@ -784,6 +736,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( @@ -791,7 +744,7 @@ private Mono>> deleteWithResponseAsync(String resource service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -809,7 +762,7 @@ private Mono>> deleteWithResponseAsync(String resource * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -833,12 +786,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, @@ -854,14 +808,15 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @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, Context.NONE); + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); } /** @@ -873,7 +828,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( @@ -893,7 +848,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName) { @@ -909,7 +864,7 @@ public SyncPoller, Void> beginDelete(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 the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( @@ -925,7 +880,7 @@ public SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String serverName) { @@ -941,7 +896,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @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) { @@ -987,7 +942,7 @@ public void delete(String resourceGroupName, String serverName, Context context) * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return information about a server along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByResourceGroupWithResponseAsync( @@ -1011,6 +966,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( @@ -1018,7 +974,7 @@ private Mono> getByResourceGroupWithResponseAsync( service .getByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1036,7 +992,7 @@ private Mono> getByResourceGroupWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return information about a server along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByResourceGroupWithResponseAsync( @@ -1060,12 +1016,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, @@ -1081,19 +1038,12 @@ private Mono> getByResourceGroupWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 server. + * @return information about a server on successful completion of {@link Mono}. */ @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())); } /** @@ -1101,14 +1051,16 @@ private Mono getByResourceGroupAsync(String resourceGroupName, Stri * * @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 server. + * @return information about a server along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { - return getByResourceGroupAsync(resourceGroupName, serverName).block(); + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, context).block(); } /** @@ -1116,16 +1068,14 @@ public ServerInner getByResourceGroup(String resourceGroupName, String serverNam * * @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 server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse( - String resourceGroupName, String serverName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, context).block(); + public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + return getByResourceGroupWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); } /** @@ -1135,7 +1085,7 @@ public Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @return a list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { @@ -1155,6 +1105,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( @@ -1162,7 +1113,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri service .listByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, accept, @@ -1170,12 +1121,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())); } @@ -1187,7 +1133,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of servers. + * @return a list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync( @@ -1208,12 +1154,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, @@ -1221,12 +1168,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)); } /** @@ -1236,13 +1178,11 @@ private Mono> listByResourceGroupSinglePageAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @return a list of servers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); } /** @@ -1253,13 +1193,11 @@ private PagedFlux listByResourceGroupAsync(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 servers. + * @return a list of servers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); } /** @@ -1269,7 +1207,7 @@ private PagedFlux listByResourceGroupAsync(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 servers. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -1284,7 +1222,7 @@ public PagedIterable listByResourceGroup(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 servers. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { @@ -1296,7 +1234,7 @@ public PagedIterable listByResourceGroup(String resourceGroupName, * * @throws ManagementException 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. + * @return a list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -1312,26 +1250,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())); } @@ -1342,7 +1271,7 @@ 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 servers. + * @return a list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { @@ -1358,24 +1287,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)); } /** @@ -1383,11 +1303,11 @@ private Mono> listSinglePageAsync(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 servers. + * @return a list of servers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listSinglePageAsync()); } /** @@ -1397,12 +1317,11 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @return a list of servers 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 new PagedFlux<>(() -> listSinglePageAsync(context)); } /** @@ -1410,7 +1329,7 @@ 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 servers. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -1424,7 +1343,7 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { @@ -1436,15 +1355,13 @@ public PagedIterable list(Context context) { * * @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 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 completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> restartWithResponseAsync( - String resourceGroupName, String serverName, RestartParameter parameters) { + private Mono>> restartWithResponseAsync(String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1464,9 +1381,7 @@ private Mono>> restartWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } - if (parameters != null) { - parameters.validate(); - } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1474,11 +1389,10 @@ private Mono>> restartWithResponseAsync( service .restart( 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())); @@ -1489,16 +1403,15 @@ private Mono>> restartWithResponseAsync( * * @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 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. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> restartWithResponseAsync( - String resourceGroupName, String serverName, RestartParameter parameters, Context context) { + String resourceGroupName, String serverName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1518,19 +1431,16 @@ private Mono>> restartWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } - if (parameters != null) { - parameters.validate(); - } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .restart( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, - parameters, accept, context); } @@ -1540,19 +1450,18 @@ private Mono>> restartWithResponseAsync( * * @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 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 completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginRestartAsync( - String resourceGroupName, String serverName, RestartParameter parameters) { - Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName, parameters); + private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String serverName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName); return this .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); } /** @@ -1560,19 +1469,17 @@ private PollerFlux, Void> beginRestartAsync( * * @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 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. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginRestartAsync( - String resourceGroupName, String serverName, RestartParameter parameters, Context context) { + String resourceGroupName, String serverName, Context context) { context = this.client.mergeContext(context); - Mono>> mono = - restartWithResponseAsync(resourceGroupName, serverName, parameters, context); + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName, context); return this .client .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); @@ -1583,16 +1490,14 @@ private PollerFlux, Void> beginRestartAsync( * * @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 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 completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, RestartParameter parameters) { - return beginRestartAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + public SyncPoller, Void> beginRestart(String resourceGroupName, String serverName) { + return beginRestartAsync(resourceGroupName, serverName).getSyncPoller(); } /** @@ -1600,35 +1505,16 @@ public SyncPoller, Void> beginRestart( * * @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 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. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, RestartParameter parameters, Context context) { - return beginRestartAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); - } - - /** - * Restarts a 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 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 completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono restartAsync(String resourceGroupName, String serverName, RestartParameter parameters) { - return beginRestartAsync(resourceGroupName, serverName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + String resourceGroupName, String serverName, Context context) { + return beginRestartAsync(resourceGroupName, serverName, context).getSyncPoller(); } /** @@ -1639,14 +1525,11 @@ private Mono restartAsync(String resourceGroupName, String serverName, Res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono restartAsync(String resourceGroupName, String serverName) { - final RestartParameter parameters = null; - return beginRestartAsync(resourceGroupName, serverName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + return beginRestartAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); } /** @@ -1654,36 +1537,19 @@ private Mono restartAsync(String resourceGroupName, String serverName) { * * @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 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. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono restartAsync( - String resourceGroupName, String serverName, RestartParameter parameters, Context context) { - return beginRestartAsync(resourceGroupName, serverName, parameters, context) + private Mono restartAsync(String resourceGroupName, String serverName, Context context) { + return beginRestartAsync(resourceGroupName, serverName, context) .last() .flatMap(this.client::getLroFinalResultOrError); } - /** - * Restarts a 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 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, RestartParameter parameters) { - restartAsync(resourceGroupName, serverName, parameters).block(); - } - /** * Restarts a server. * @@ -1695,8 +1561,7 @@ public void restart(String resourceGroupName, String serverName, RestartParamete */ @ServiceMethod(returns = ReturnType.SINGLE) public void restart(String resourceGroupName, String serverName) { - final RestartParameter parameters = null; - restartAsync(resourceGroupName, serverName, parameters).block(); + restartAsync(resourceGroupName, serverName).block(); } /** @@ -1704,607 +1569,13 @@ public void restart(String resourceGroupName, String serverName) { * * @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 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, RestartParameter parameters, Context context) { - restartAsync(resourceGroupName, serverName, parameters, context).block(); - } - - /** - * Starts 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 the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> startWithResponseAsync(String resourceGroupName, String serverName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .start( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Starts 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 the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> startWithResponseAsync( - String resourceGroupName, String serverName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .start( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context); - } - - /** - * Starts 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStartAsync(String resourceGroupName, String serverName) { - Mono>> mono = startWithResponseAsync(resourceGroupName, serverName); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); - } - - /** - * Starts 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStartAsync( - String resourceGroupName, String serverName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = startWithResponseAsync(resourceGroupName, serverName, context); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); - } - - /** - * Starts 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStart(String resourceGroupName, String serverName) { - return beginStartAsync(resourceGroupName, serverName).getSyncPoller(); - } - - /** - * Starts 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStart(String resourceGroupName, String serverName, Context context) { - return beginStartAsync(resourceGroupName, serverName, context).getSyncPoller(); - } - - /** - * Starts 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 the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono startAsync(String resourceGroupName, String serverName) { - return beginStartAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Starts 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 the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono startAsync(String resourceGroupName, String serverName, Context context) { - return beginStartAsync(resourceGroupName, serverName, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Starts 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void start(String resourceGroupName, String serverName) { - startAsync(resourceGroupName, serverName).block(); - } - - /** - * Starts 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void start(String resourceGroupName, String serverName, Context context) { - startAsync(resourceGroupName, serverName, context).block(); - } - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> stopWithResponseAsync(String resourceGroupName, String serverName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .stop( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> stopWithResponseAsync( - String resourceGroupName, String serverName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .stop( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context); - } - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStopAsync(String resourceGroupName, String serverName) { - Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); - } - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStopAsync( - String resourceGroupName, String serverName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName, context); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); - } - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStop(String resourceGroupName, String serverName) { - return beginStopAsync(resourceGroupName, serverName).getSyncPoller(); - } - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStop(String resourceGroupName, String serverName, Context context) { - return beginStopAsync(resourceGroupName, serverName, context).getSyncPoller(); - } - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono stopAsync(String resourceGroupName, String serverName) { - return beginStopAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Stops 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 the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono stopAsync(String resourceGroupName, String serverName, Context context) { - return beginStopAsync(resourceGroupName, serverName, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Stops 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void stop(String resourceGroupName, String serverName) { - stopAsync(resourceGroupName, serverName).block(); - } - - /** - * Stops 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. - */ - @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. - */ - @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. - */ - @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. - */ - @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. - */ - @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 restart(String resourceGroupName, String serverName, Context context) { + restartAsync(resourceGroupName, serverName, context).block(); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersImpl.java index e63332b338f9..5863cb472dfb 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersImpl.java @@ -11,13 +11,11 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServersClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; import com.azure.resourcemanager.postgresqlflexibleserver.models.Servers; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ServersImpl implements Servers { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ServersImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ServersImpl.class); private final ServersClient innerClient; @@ -38,15 +36,6 @@ public void delete(String resourceGroupName, String serverName, Context context) this.serviceClient().delete(resourceGroupName, serverName, context); } - public Server getByResourceGroup(String resourceGroupName, String serverName) { - ServerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, serverName); - if (inner != null) { - return new ServerImpl(inner, this.manager()); - } else { - return null; - } - } - public Response getByResourceGroupWithResponse( String resourceGroupName, String serverName, Context context) { Response inner = @@ -62,6 +51,15 @@ public Response getByResourceGroupWithResponse( } } + public Server getByResourceGroup(String resourceGroupName, String serverName) { + ServerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, serverName); + if (inner != null) { + return new ServerImpl(inner, this.manager()); + } else { + return null; + } + } + public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); @@ -82,50 +80,29 @@ public PagedIterable list(Context context) { return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); } - public void restart(String resourceGroupName, String serverName, RestartParameter parameters) { - this.serviceClient().restart(resourceGroupName, serverName, parameters); - } - public void restart(String resourceGroupName, String serverName) { this.serviceClient().restart(resourceGroupName, serverName); } - public void restart(String resourceGroupName, String serverName, RestartParameter parameters, Context context) { - this.serviceClient().restart(resourceGroupName, serverName, parameters, context); - } - - public void start(String resourceGroupName, String serverName) { - this.serviceClient().start(resourceGroupName, serverName); - } - - public void start(String resourceGroupName, String serverName, Context context) { - this.serviceClient().start(resourceGroupName, serverName, context); - } - - public void stop(String resourceGroupName, String serverName) { - this.serviceClient().stop(resourceGroupName, serverName); - } - - public void stop(String resourceGroupName, String serverName, Context context) { - this.serviceClient().stop(resourceGroupName, serverName, context); + public void restart(String resourceGroupName, String serverName, Context context) { + this.serviceClient().restart(resourceGroupName, serverName, context); } public Server getById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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(); } @@ -133,19 +110,18 @@ public Server getById(String id) { public Response getByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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); } @@ -153,19 +129,18 @@ public Response getByIdWithResponse(String id, Context context) { public void deleteById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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); } @@ -173,19 +148,18 @@ public void deleteById(String id) { public void deleteByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( 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 + 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRuleImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRuleImpl.java new file mode 100644 index 000000000000..632cc5235eda --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRuleImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRule; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRuleState; + +public final class VirtualNetworkRuleImpl + implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { + private VirtualNetworkRuleInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String 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.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager 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.postgresqlflexibleserver.PostgreSqlManager 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesClientImpl.java new file mode 100644 index 000000000000..71ce2d357ac4 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesClientImpl.java @@ -0,0 +1,1149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.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.postgresqlflexibleserver.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworkRulesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(VirtualNetworkRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientVirtualNetworkRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + public interface VirtualNetworkRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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.DBforPostgreSQL" + + "/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. + * @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(); + } + + /** + * 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 getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE).getValue(); + } + + /** + * 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 URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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 URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesImpl.java new file mode 100644 index 000000000000..d32c5a31343a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRule; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public VirtualNetworkRulesImpl( + VirtualNetworkRulesClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + public VirtualNetworkRuleImpl define(String name) { + return new VirtualNetworkRuleImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AdministratorType.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AdministratorType.java new file mode 100644 index 000000000000..dbf1a9b41af9 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AdministratorType.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.postgresqlflexibleserver.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The type of administrator. */ +public enum AdministratorType { + /** Enum value ActiveDirectory. */ + ACTIVE_DIRECTORY("ActiveDirectory"); + + /** The actual serialized value for a AdministratorType instance. */ + private final String value; + + AdministratorType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AdministratorType instance. + * + * @param value the serialized value to parse. + * @return the parsed AdministratorType object, or null if unable to parse. + */ + @JsonCreator + public static AdministratorType fromString(String value) { + if (value == null) { + return null; + } + AdministratorType[] items = AdministratorType.values(); + for (AdministratorType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Backup.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Backup.java deleted file mode 100644 index 2d9a197b1740..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Backup.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** Backup properties of a server. */ -@Fluent -public final class Backup { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Backup.class); - - /* - * Backup retention days for the server. - */ - @JsonProperty(value = "backupRetentionDays") - private Integer backupRetentionDays; - - /* - * A value indicating whether Geo-Redundant backup is enabled on the - * server. - */ - @JsonProperty(value = "geoRedundantBackup") - private GeoRedundantBackupEnum geoRedundantBackup; - - /* - * The earliest restore point time (ISO8601 format) for server. - */ - @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: A value indicating whether Geo-Redundant backup is enabled on the server. - * - * @return the geoRedundantBackup value. - */ - public GeoRedundantBackupEnum geoRedundantBackup() { - return this.geoRedundantBackup; - } - - /** - * Set the geoRedundantBackup property: A value indicating whether Geo-Redundant backup is enabled on the server. - * - * @param geoRedundantBackup the geoRedundantBackup value to set. - * @return the Backup object itself. - */ - public Backup withGeoRedundantBackup(GeoRedundantBackupEnum geoRedundantBackup) { - this.geoRedundantBackup = geoRedundantBackup; - return this; - } - - /** - * Get the earliestRestoreDate property: The earliest restore point time (ISO8601 format) for server. - * - * @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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityProperties.java deleted file mode 100644 index f2799bb69683..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityProperties.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import java.util.List; - -/** An immutable client-side representation of CapabilityProperties. */ -public interface CapabilityProperties { - /** - * Gets the zone property: zone name. - * - * @return the zone value. - */ - String zone(); - - /** - * Gets the geoBackupSupported property: A value indicating whether a new server in this region can have geo-backups - * to paired region. - * - * @return the geoBackupSupported value. - */ - Boolean geoBackupSupported(); - - /** - * Gets the zoneRedundantHaSupported property: A value indicating whether a new server in this region can support - * multi zone HA. - * - * @return the zoneRedundantHaSupported value. - */ - Boolean zoneRedundantHaSupported(); - - /** - * Gets the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether a new server in this region - * can have geo-backups to paired region. - * - * @return the zoneRedundantHaAndGeoBackupSupported value. - */ - Boolean zoneRedundantHaAndGeoBackupSupported(); - - /** - * Gets the supportedFlexibleServerEditions property: The supportedFlexibleServerEditions property. - * - * @return the supportedFlexibleServerEditions value. - */ - List supportedFlexibleServerEditions(); - - /** - * Gets the supportedHyperscaleNodeEditions property: The supportedHyperscaleNodeEditions property. - * - * @return the supportedHyperscaleNodeEditions value. - */ - List supportedHyperscaleNodeEditions(); - - /** - * Gets the status property: The status. - * - * @return the status value. - */ - String status(); - - /** - * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner object. - * - * @return the inner object. - */ - CapabilityPropertiesInner innerModel(); -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CheckNameAvailabilities.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CheckNameAvailabilities.java index 2b77ea251ed8..7bf02fd52f95 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CheckNameAvailabilities.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CheckNameAvailabilities.java @@ -13,22 +13,22 @@ public interface CheckNameAvailabilities { * Check the availability of name for resource. * * @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. + * @return represents a resource name availability along with {@link Response}. */ - NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest); + Response executeWithResponse(NameAvailabilityRequest nameAvailabilityRequest, Context context); /** * Check the availability of name for resource. * * @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. */ - Response executeWithResponse(NameAvailabilityRequest nameAvailabilityRequest, Context context); + NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configuration.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configuration.java index 3d97d7b2ce17..da4f4cc626cd 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configuration.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configuration.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; @@ -31,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. * @@ -64,7 +56,7 @@ public interface Configuration { * * @return the dataType value. */ - ConfigurationDataType dataType(); + String dataType(); /** * Gets the allowedValues property: Allowed values of the configuration. @@ -80,6 +72,13 @@ public interface Configuration { */ String source(); + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner object. * @@ -105,7 +104,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 Configuration definition which contains all the minimum required properties for the resource diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationDataType.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationDataType.java deleted file mode 100644 index 2ad8baef47f3..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationDataType.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ConfigurationDataType. */ -public final class ConfigurationDataType extends ExpandableStringEnum { - /** Static value Boolean for ConfigurationDataType. */ - public static final ConfigurationDataType BOOLEAN = fromString("Boolean"); - - /** Static value Numeric for ConfigurationDataType. */ - public static final ConfigurationDataType NUMERIC = fromString("Numeric"); - - /** Static value Integer for ConfigurationDataType. */ - public static final ConfigurationDataType INTEGER = fromString("Integer"); - - /** Static value Enumeration for ConfigurationDataType. */ - public static final ConfigurationDataType ENUMERATION = fromString("Enumeration"); - - /** - * Creates or finds a ConfigurationDataType from its string representation. - * - * @param name a name to look for. - * @return the corresponding ConfigurationDataType. - */ - @JsonCreator - public static ConfigurationDataType fromString(String name) { - return fromString(name, ConfigurationDataType.class); - } - - /** @return known ConfigurationDataType values. */ - public static Collection values() { - return values(ConfigurationDataType.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationListResult.java index a3dbf2b42d81..4fc178139c66 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationListResult.java @@ -4,78 +4,23 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; import java.util.List; -/** A list of server configurations. */ -@Fluent -public final class ConfigurationListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationListResult.class); - - /* - * The list of server configurations. - */ - @JsonProperty(value = "value") - private List value; - - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - +/** An immutable client-side representation of ConfigurationListResult. */ +public interface ConfigurationListResult { /** - * Get the value property: The list of server configurations. + * Gets the value property: The list of server configurations. * * @return the value value. */ - public List value() { - return this.value; - } - - /** - * Set the value property: The list of server configurations. - * - * @param value the value value to set. - * @return the ConfigurationListResult object itself. - */ - public ConfigurationListResult 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 ConfigurationListResult object itself. - */ - public ConfigurationListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } + List value(); /** - * Validates the instance. + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner + * 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()); - } - } + ConfigurationListResultInner innerModel(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configurations.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configurations.java index 5a652717ea7f..fd159cc64bb7 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configurations.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configurations.java @@ -11,57 +11,57 @@ /** Resource collection API of Configurations. */ public interface Configurations { /** - * 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 configurationName The name of the 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 information about a configuration of server along with {@link Response}. */ - PagedIterable listByServer(String resourceGroupName, String serverName); + Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, 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 context The context to associate with this operation. + * @param configurationName The name of the 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 information about a configuration of server. */ - PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + Configuration get(String resourceGroupName, String serverName, String configurationName); /** - * Gets information about a configuration of 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 configurationName The name of the 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 information about a configuration of server. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ - Configuration get(String resourceGroupName, String serverName, String configurationName); + PagedIterable listByServer(String resourceGroupName, String serverName); /** - * Gets information about a configuration of 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 configurationName The name of the 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 information about a configuration of server. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ - Response getWithResponse( - String resourceGroupName, String serverName, String configurationName, Context context); + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); /** * Gets information about a configuration of server. @@ -70,7 +70,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 information about a configuration of server. + * @return information about a configuration of server along with {@link Response}. */ Configuration getById(String id); @@ -82,7 +82,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 information about a configuration of server. + * @return information about a configuration of server along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java index 52ef2e4ee6bc..db217d6c672b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java @@ -8,20 +8,20 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for CreateMode. */ +/** The mode to create a new server. */ public final class CreateMode extends ExpandableStringEnum { /** Static value Default for CreateMode. */ public static final CreateMode DEFAULT = fromString("Default"); - /** Static value Create for CreateMode. */ - public static final CreateMode CREATE = fromString("Create"); - - /** Static value Update for CreateMode. */ - public static final CreateMode UPDATE = fromString("Update"); - /** Static value PointInTimeRestore for CreateMode. */ public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + /** 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateModeForUpdate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateModeForUpdate.java deleted file mode 100644 index fe86dc41cd21..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateModeForUpdate.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for CreateModeForUpdate. */ -public final class CreateModeForUpdate extends ExpandableStringEnum { - /** Static value Default for CreateModeForUpdate. */ - public static final CreateModeForUpdate DEFAULT = fromString("Default"); - - /** Static value Update for CreateModeForUpdate. */ - public static final CreateModeForUpdate UPDATE = fromString("Update"); - - /** - * Creates or finds a CreateModeForUpdate from its string representation. - * - * @param name a name to look for. - * @return the corresponding CreateModeForUpdate. - */ - @JsonCreator - public static CreateModeForUpdate fromString(String name) { - return fromString(name, CreateModeForUpdate.class); - } - - /** @return known CreateModeForUpdate values. */ - public static Collection values() { - return values(CreateModeForUpdate.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Database.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Database.java index e76a42f4f8c9..09c29d75db19 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Database.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Database.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.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 @@ -120,6 +119,53 @@ interface WithCollation { WithCreate withCollation(String collation); } } + /** + * Begins update for the Database resource. + * + * @return the stage of resource update. + */ + Database.Update update(); + + /** The template for Database update. */ + interface Update extends UpdateStages.WithCharset, UpdateStages.WithCollation { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Database apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Database apply(Context context); + } + /** The Database update stages. */ + interface UpdateStages { + /** The stage of the Database update allowing to specify charset. */ + interface WithCharset { + /** + * Specifies the charset property: The charset of the database.. + * + * @param charset The charset of the database. + * @return the next definition stage. + */ + Update withCharset(String charset); + } + /** The stage of the Database update allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: The collation of the database.. + * + * @param collation The collation of the database. + * @return the next definition stage. + */ + Update withCollation(String collation); + } + } /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DatabaseListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DatabaseListResult.java index 89f858bbda9a..4eb2cd79ac8a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DatabaseListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DatabaseListResult.java @@ -5,28 +5,22 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.DatabaseInner; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** A List of databases. */ @Fluent public final class DatabaseListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseListResult.class); - /* * The list of databases housed in a server */ @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of databases. - */ - @JsonProperty(value = "nextLink") - private String nextLink; + /** Creates an instance of DatabaseListResult class. */ + public DatabaseListResult() { + } /** * Get the value property: The list of databases housed in a server. @@ -48,26 +42,6 @@ public DatabaseListResult withValue(List value) { return this; } - /** - * Get the nextLink property: The link used to get the next page of databases. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The link used to get the next page of databases. - * - * @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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Databases.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Databases.java index 6fa4c3f5f257..80afe8975a38 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Databases.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Databases.java @@ -41,12 +41,14 @@ public interface Databases { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @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 information about a database. + * @return information about a database along with {@link Response}. */ - Database get(String resourceGroupName, String serverName, String databaseName); + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); /** * Gets information about a database. @@ -54,14 +56,12 @@ public interface Databases { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @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 information about a database. */ - Response getWithResponse( - String resourceGroupName, String serverName, String databaseName, Context context); + Database get(String resourceGroupName, String serverName, String databaseName); /** * List all the databases in a given server. @@ -71,7 +71,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 databases. + * @return a List of databases as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName); @@ -84,7 +84,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 databases. + * @return a List of databases as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName, Context context); @@ -95,7 +95,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 information about a database. + * @return information about a database along with {@link Response}. */ Database getById(String id); @@ -107,7 +107,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 information about a database. + * @return information about a database along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DelegatedSubnetUsage.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DelegatedSubnetUsage.java deleted file mode 100644 index 49a79c73012b..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DelegatedSubnetUsage.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.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Delegated subnet usage data. */ -@Immutable -public final class DelegatedSubnetUsage { - @JsonIgnore private final ClientLogger logger = new ClientLogger(DelegatedSubnetUsage.class); - - /* - * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FailoverMode.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FailoverMode.java deleted file mode 100644 index 650b61543c03..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FailoverMode.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for FailoverMode. */ -public final class FailoverMode extends ExpandableStringEnum { - /** Static value PlannedFailover for FailoverMode. */ - public static final FailoverMode PLANNED_FAILOVER = fromString("PlannedFailover"); - - /** Static value ForcedFailover for FailoverMode. */ - public static final FailoverMode FORCED_FAILOVER = fromString("ForcedFailover"); - - /** Static value PlannedSwitchover for FailoverMode. */ - public static final FailoverMode PLANNED_SWITCHOVER = fromString("PlannedSwitchover"); - - /** Static value ForcedSwitchover for FailoverMode. */ - public static final FailoverMode FORCED_SWITCHOVER = fromString("ForcedSwitchover"); - - /** - * Creates or finds a FailoverMode from its string representation. - * - * @param name a name to look for. - * @return the corresponding FailoverMode. - */ - @JsonCreator - public static FailoverMode fromString(String name) { - return fromString(name, FailoverMode.class); - } - - /** @return known FailoverMode values. */ - public static Collection values() { - return values(FailoverMode.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRule.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRule.java index d1827e1d80c4..6629d251bcea 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRule.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRule.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRuleListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRuleListResult.java index 2c28efd29e47..ccca96666dca 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRuleListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRuleListResult.java @@ -5,28 +5,22 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FirewallRuleInner; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** A list of firewall rules. */ @Fluent public final class FirewallRuleListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleListResult.class); - /* * The list of firewall rules in a server. */ @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; + /** Creates an instance of FirewallRuleListResult class. */ + public FirewallRuleListResult() { + } /** * Get the value property: The list of firewall rules in a server. @@ -48,26 +42,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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRules.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRules.java index 434fedc573dd..d0c2fc9d8532 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRules.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRules.java @@ -11,7 +11,7 @@ /** Resource collection API of FirewallRules. */ public interface FirewallRules { /** - * Deletes a PostgreSQL server 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 PostgreSQL server 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. @@ -36,47 +36,47 @@ public interface FirewallRules { void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param firewallRuleName The name of the server firewall rule. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a server firewall rule. + * @return information about a server firewall rule along with {@link Response}. */ - FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param firewallRuleName The name of the server firewall rule. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a server firewall rule. + * @return information about a server firewall rule. */ - Response getWithResponse( - String resourceGroupName, String serverName, String firewallRuleName, Context context); + FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules 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 firewall rules. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName); /** - * List all the firewall rules in a given PostgreSQL server. + * List all the firewall rules in a given server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. @@ -84,35 +84,35 @@ 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 firewall rules. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName, Context context); /** - * List all the firewall rules in a given server. + * Gets information about a server firewall 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 represents a server firewall rule. + * @return information about a server firewall rule along with {@link Response}. */ FirewallRule getById(String id); /** - * List all the firewall rules in a given server. + * Gets information about a server firewall 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 represents a server firewall rule. + * @return information about a server firewall rule along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); /** - * Deletes a PostgreSQL server 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 PostgreSQL server 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java deleted file mode 100644 index 8e897aec4146..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Flexible server edition capabilities. */ -@Immutable -public final class FlexibleServerEditionCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FlexibleServerEditionCapability.class); - - /* - * Server edition name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The list of editions supported by this server edition. - */ - @JsonProperty(value = "supportedStorageEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageEditions; - - /* - * The list of server versions supported by this server edition. - */ - @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedServerVersions; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: Server edition name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedStorageEditions property: The list of editions supported by this server edition. - * - * @return the supportedStorageEditions value. - */ - public List supportedStorageEditions() { - return this.supportedStorageEditions; - } - - /** - * Get the supportedServerVersions property: The list of server versions supported by this server edition. - * - * @return the supportedServerVersions value. - */ - public List supportedServerVersions() { - return this.supportedServerVersions; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedStorageEditions() != null) { - supportedStorageEditions().forEach(e -> e.validate()); - } - if (supportedServerVersions() != null) { - supportedServerVersions().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackup.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackup.java new file mode 100644 index 000000000000..c91a079c6d1a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enable Geo-redundant or not for server backup. */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackupEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackupEnum.java deleted file mode 100644 index 0a748facd2ba..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackupEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for GeoRedundantBackupEnum. */ -public final class GeoRedundantBackupEnum extends ExpandableStringEnum { - /** Static value Enabled for GeoRedundantBackupEnum. */ - public static final GeoRedundantBackupEnum ENABLED = fromString("Enabled"); - - /** Static value Disabled for GeoRedundantBackupEnum. */ - public static final GeoRedundantBackupEnum DISABLED = fromString("Disabled"); - - /** - * Creates or finds a GeoRedundantBackupEnum from its string representation. - * - * @param name a name to look for. - * @return the corresponding GeoRedundantBackupEnum. - */ - @JsonCreator - public static GeoRedundantBackupEnum fromString(String name) { - return fromString(name, GeoRedundantBackupEnum.class); - } - - /** @return known GeoRedundantBackupEnum values. */ - public static Collection values() { - return values(GeoRedundantBackupEnum.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java deleted file mode 100644 index ce8b75e03617..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** Resource collection API of GetPrivateDnsZoneSuffixes. */ -public interface GetPrivateDnsZoneSuffixes { - /** - * Get private DNS zone suffix in the cloud. - * - * @throws com.azure.core.management.exception.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. - */ - String execute(); - - /** - * 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 com.azure.core.management.exception.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. - */ - Response executeWithResponse(Context context); -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailability.java deleted file mode 100644 index 2a5c28d6e7e3..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailability.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** High availability properties of a server. */ -@Fluent -public final class HighAvailability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(HighAvailability.class); - - /* - * The HA mode for the server. - */ - @JsonProperty(value = "mode") - private HighAvailabilityMode mode; - - /* - * A state of a HA server that is visible to user. - */ - @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) - private ServerHAState state; - - /* - * availability zone information of the standby. - */ - @JsonProperty(value = "standbyAvailabilityZone") - private String standbyAvailabilityZone; - - /** - * Get the mode property: The HA mode for the server. - * - * @return the mode value. - */ - public HighAvailabilityMode mode() { - return this.mode; - } - - /** - * Set the mode property: The HA mode for the 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: A state of a HA server that is visible to user. - * - * @return the state value. - */ - public ServerHAState state() { - return this.state; - } - - /** - * Get the standbyAvailabilityZone property: availability zone information of the standby. - * - * @return the standbyAvailabilityZone value. - */ - public String standbyAvailabilityZone() { - return this.standbyAvailabilityZone; - } - - /** - * Set the standbyAvailabilityZone property: availability zone information of the standby. - * - * @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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailabilityMode.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailabilityMode.java deleted file mode 100644 index eed7bcb19113..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailabilityMode.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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"); - - /** - * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java deleted file mode 100644 index cc91921e4d67..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Hyperscale node edition capabilities. */ -@Immutable -public final class HyperscaleNodeEditionCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(HyperscaleNodeEditionCapability.class); - - /* - * Server edition name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The list of editions supported by this server edition. - */ - @JsonProperty(value = "supportedStorageEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageEditions; - - /* - * The list of server versions supported by this server edition. - */ - @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedServerVersions; - - /* - * The list of Node Types supported by this server edition. - */ - @JsonProperty(value = "supportedNodeTypes", access = JsonProperty.Access.WRITE_ONLY) - private List supportedNodeTypes; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: Server edition name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedStorageEditions property: The list of editions supported by this server edition. - * - * @return the supportedStorageEditions value. - */ - public List supportedStorageEditions() { - return this.supportedStorageEditions; - } - - /** - * Get the supportedServerVersions property: The list of server versions supported by this server edition. - * - * @return the supportedServerVersions value. - */ - public List supportedServerVersions() { - return this.supportedServerVersions; - } - - /** - * Get the supportedNodeTypes property: The list of Node Types supported by this server edition. - * - * @return the supportedNodeTypes value. - */ - public List supportedNodeTypes() { - return this.supportedNodeTypes; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedStorageEditions() != null) { - supportedStorageEditions().forEach(e -> e.validate()); - } - if (supportedServerVersions() != null) { - supportedServerVersions().forEach(e -> e.validate()); - } - if (supportedNodeTypes() != null) { - supportedNodeTypes().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.java new file mode 100644 index 000000000000..36432b2e2112 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory + * principal for the resource. + */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/InfrastructureEncryption.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/InfrastructureEncryption.java new file mode 100644 index 000000000000..0e646b595914 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/InfrastructureEncryption.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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Add a second layer of encryption for your data using new encryption algorithm which gives additional data protection. + * Value is optional but if passed in, must be 'Disabled' or 'Enabled'. + */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedPerformanceTiers.java similarity index 64% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedPerformanceTiers.java index 16b8b88d359e..18e443793620 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedPerformanceTiers.java @@ -7,28 +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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ - PagedIterable execute(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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ - PagedIterable execute(String locationName, Context context); + PagedIterable list(String locationName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFile.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFile.java new file mode 100644 index 000000000000..6c901e07b052 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of LogFile. */ +public interface LogFile { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the 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.postgresqlflexibleserver.fluent.models.LogFileInner object. + * + * @return the inner object. + */ + LogFileInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFileListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFileListResult.java new file mode 100644 index 000000000000..d04de20415c3 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFileListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of log files. */ +@Fluent +public final class LogFileListResult { + /* + * The list of log files. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of LogFileListResult class. */ + public LogFileListResult() { + } + + /** + * Get the value property: The list of log files. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of log files. + * + * @param value the value value to set. + * @return the LogFileListResult object itself. + */ + public LogFileListResult 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFiles.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFiles.java new file mode 100644 index 000000000000..11c41a2affe6 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFiles.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LogFiles. */ +public interface LogFiles { + /** + * List all the 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MaintenanceWindow.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MaintenanceWindow.java deleted file mode 100644 index 873a552898e9..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MaintenanceWindow.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Maintenance window properties of a server. */ -@Fluent -public final class MaintenanceWindow { - @JsonIgnore private final ClientLogger logger = new ClientLogger(MaintenanceWindow.class); - - /* - * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MinimalTlsVersionEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MinimalTlsVersionEnum.java new file mode 100644 index 000000000000..89473911c9f8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enforce a minimal Tls version for the server. */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailability.java index 8b9fc32300db..81ac4318d42b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailability.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailability.java @@ -23,18 +23,11 @@ public interface NameAvailability { Boolean nameAvailable(); /** - * Gets the name property: name of the PostgreSQL server. + * Gets the reason property: Reason for name being unavailable. * - * @return the name value. + * @return the reason value. */ - String name(); - - /** - * Gets the type property: type of the server. - * - * @return the type value. - */ - String type(); + String reason(); /** * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.NameAvailabilityInner object. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailabilityRequest.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailabilityRequest.java index d72efc1cee26..78985a351f72 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailabilityRequest.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailabilityRequest.java @@ -6,14 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Request from client to check resource name availability. */ @Fluent public final class NameAvailabilityRequest { - @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityRequest.class); - /* * Resource name to verify. */ @@ -26,6 +23,10 @@ public final class NameAvailabilityRequest { @JsonProperty(value = "type") private String type; + /** Creates an instance of NameAvailabilityRequest class. */ + public NameAvailabilityRequest() { + } + /** * Get the name property: Resource name to verify. * @@ -73,9 +74,11 @@ public NameAvailabilityRequest withType(String type) { */ public void validate() { if (name() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property name in model NameAvailabilityRequest")); } } + + private static final ClientLogger LOGGER = new ClientLogger(NameAvailabilityRequest.class); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java deleted file mode 100644 index 3beddc4f1538..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Network properties of a server. */ -@Fluent -public final class Network { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Network.class); - - /* - * public network access is enabled or not - */ - @JsonProperty(value = "publicNetworkAccess", access = JsonProperty.Access.WRITE_ONLY) - private ServerPublicNetworkAccessState publicNetworkAccess; - - /* - * delegated subnet arm resource id. - */ - @JsonProperty(value = "delegatedSubnetResourceId") - private String delegatedSubnetResourceId; - - /* - * private dns zone arm resource id. - */ - @JsonProperty(value = "privateDnsZoneArmResourceId") - private String privateDnsZoneArmResourceId; - - /** - * Get the publicNetworkAccess property: public network access is enabled or not. - * - * @return the publicNetworkAccess value. - */ - public ServerPublicNetworkAccessState publicNetworkAccess() { - return this.publicNetworkAccess; - } - - /** - * Get the delegatedSubnetResourceId property: delegated subnet arm resource id. - * - * @return the delegatedSubnetResourceId value. - */ - public String delegatedSubnetResourceId() { - return this.delegatedSubnetResourceId; - } - - /** - * Set the delegatedSubnetResourceId property: delegated subnet arm resource id. - * - * @param delegatedSubnetResourceId the delegatedSubnetResourceId value to set. - * @return the Network object itself. - */ - public Network withDelegatedSubnetResourceId(String delegatedSubnetResourceId) { - this.delegatedSubnetResourceId = delegatedSubnetResourceId; - return this; - } - - /** - * Get the privateDnsZoneArmResourceId property: private dns zone arm resource id. - * - * @return the privateDnsZoneArmResourceId value. - */ - public String privateDnsZoneArmResourceId() { - return this.privateDnsZoneArmResourceId; - } - - /** - * Set the privateDnsZoneArmResourceId property: private dns zone arm resource id. - * - * @param privateDnsZoneArmResourceId the privateDnsZoneArmResourceId value to set. - * @return the Network object itself. - */ - public Network withPrivateDnsZoneArmResourceId(String privateDnsZoneArmResourceId) { - this.privateDnsZoneArmResourceId = privateDnsZoneArmResourceId; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NodeTypeCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NodeTypeCapability.java deleted file mode 100644 index 0ff57ce894e6..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NodeTypeCapability.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** node type capability. */ -@Immutable -public final class NodeTypeCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(NodeTypeCapability.class); - - /* - * note type name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * note type - */ - @JsonProperty(value = "nodeType", access = JsonProperty.Access.WRITE_ONLY) - private String nodeType; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: note type name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the nodeType property: note type. - * - * @return the nodeType value. - */ - public String nodeType() { - return this.nodeType; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operation.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operation.java index b89a559b9d72..7a87ad0bcaa8 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operation.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operation.java @@ -4,18 +4,14 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; /** REST API operation definition. */ -@Fluent +@Immutable public final class Operation { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); - /* * The name of the operation being performed on this particular object. */ @@ -23,18 +19,11 @@ public final class Operation { private String name; /* - * The localized display information for this particular operation or - * action. + * The localized display information for this particular operation or action. */ @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) private OperationDisplay display; - /* - * Indicates whether the operation is a data action - */ - @JsonProperty(value = "isDataAction") - private Boolean isDataAction; - /* * The intended executor of the operation. */ @@ -48,6 +37,10 @@ public final class Operation { @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map properties; + /** Creates an instance of Operation class. */ + public Operation() { + } + /** * Get the name property: The name of the operation being performed on this particular object. * @@ -66,26 +59,6 @@ public OperationDisplay display() { return this.display; } - /** - * Get the isDataAction property: Indicates whether the operation is a data action. - * - * @return the isDataAction value. - */ - public Boolean isDataAction() { - return this.isDataAction; - } - - /** - * Set the isDataAction property: Indicates whether the operation is a data action. - * - * @param isDataAction the isDataAction value to set. - * @return the Operation object itself. - */ - public Operation withIsDataAction(Boolean isDataAction) { - this.isDataAction = isDataAction; - return this; - } - /** * Get the origin property: The intended executor of the operation. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationDisplay.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationDisplay.java index ace8e80a16fa..54ba6b950f14 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationDisplay.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationDisplay.java @@ -5,15 +5,11 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Display metadata associated with the operation. */ @Immutable public final class OperationDisplay { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); - /* * Operation resource provider name. */ @@ -38,6 +34,10 @@ public final class OperationDisplay { @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + /** * Get the provider property: Operation resource provider name. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationListResult.java index 18f64714771b..24745916f96e 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationListResult.java @@ -10,20 +10,12 @@ /** An immutable client-side representation of OperationListResult. */ public interface OperationListResult { /** - * Gets the value property: Collection of available operation details. + * Gets the value property: The list of resource provider operations. * * @return the value value. */ List value(); - /** - * Gets the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * - * @return the nextLink value. - */ - String nextLink(); - /** * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.OperationListResultInner object. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationOrigin.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationOrigin.java index e6ee76f402d2..d3155d70065b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationOrigin.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationOrigin.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for OperationOrigin. */ +/** The intended executor of the operation. */ public final class OperationOrigin extends ExpandableStringEnum { /** Static value NotSpecified for OperationOrigin. */ public static final OperationOrigin NOT_SPECIFIED = fromString("NotSpecified"); @@ -30,7 +30,11 @@ public static OperationOrigin fromString(String name) { return fromString(name, OperationOrigin.class); } - /** @return known OperationOrigin values. */ + /** + * Gets known OperationOrigin values. + * + * @return known OperationOrigin values. + */ public static Collection values() { return values(OperationOrigin.class); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operations.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operations.java index ed6392812b1d..17f7f7fdb047 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operations.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operations.java @@ -12,20 +12,20 @@ public interface Operations { /** * 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 com.azure.core.management.exception.ManagementException 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. + * @return a list of resource provider operations along with {@link Response}. */ - OperationListResult list(); + Response listWithResponse(Context context); /** * 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 com.azure.core.management.exception.ManagementException 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. */ - Response listWithResponse(Context context); + OperationListResult list(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierListResult.java new file mode 100644 index 000000000000..4eafc2b5d943 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of PerformanceTierListResult class. */ + public PerformanceTierListResult() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierProperties.java new file mode 100644 index 000000000000..fb47604a8d6e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner + * object. + * + * @return the inner object. + */ + PerformanceTierPropertiesInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierServiceLevelObjectives.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierServiceLevelObjectives.java new file mode 100644 index 000000000000..acbc54384a5a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierServiceLevelObjectives.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.postgresqlflexibleserver.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; + + /** Creates an instance of PerformanceTierServiceLevelObjectives class. */ + public PerformanceTierServiceLevelObjectives() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnection.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..9ee03297ac76 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnection.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.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnectionListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..748471f60534 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.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; + + /** Creates an instance of PrivateEndpointConnectionListResult class. */ + public PrivateEndpointConnectionListResult() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnections.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnections.java new file mode 100644 index 000000000000..3f2728fa7295 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of 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. + * @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); + + /** + * 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); + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProperty.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProperty.java new file mode 100644 index 000000000000..aee738813cfe --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProperty.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.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; + + /** Creates an instance of PrivateEndpointProperty class. */ + public PrivateEndpointProperty() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProvisioningState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProvisioningState.java new file mode 100644 index 000000000000..b8109fe1d977 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** State of the private endpoint connection. */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResource.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResource.java new file mode 100644 index 000000000000..8ce9e7aa576f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceListResult.java new file mode 100644 index 000000000000..961adcf58b3e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.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; + + /** Creates an instance of PrivateLinkResourceListResult class. */ + public PrivateLinkResourceListResult() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..89c775544b19 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceProperties.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of PrivateLinkResourceProperties class. */ + public PrivateLinkResourceProperties() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResources.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResources.java new file mode 100644 index 000000000000..cc2af9ac90a7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources for PostgreSQL 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 PostgreSQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for PostgreSQL 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 PostgreSQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private link resource for PostgreSQL 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 PostgreSQL server along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); + + /** + * Gets a private link resource for PostgreSQL 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 PostgreSQL server. + */ + PrivateLinkResource get(String resourceGroupName, String serverName, String groupName); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateActionsRequire.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateActionsRequire.java new file mode 100644 index 000000000000..06c8523b1d9a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The actions required for private link service connection. */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 000000000000..3c1e711826b7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The 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; + + /** Creates an instance of PrivateLinkServiceConnectionStateProperty class. */ + public PrivateLinkServiceConnectionStateProperty() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateStatus.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateStatus.java new file mode 100644 index 000000000000..dd86a9dccdaa --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The private link service connection status. */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PublicNetworkAccessEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PublicNetworkAccessEnum.java new file mode 100644 index 000000000000..4226380240d6 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PublicNetworkAccessEnum.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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Whether or not public network access is allowed for this server. Value is optional but if passed in, must be + * 'Enabled' or 'Disabled'. + */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServerResource.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServerResource.java new file mode 100644 index 000000000000..bb0da41b041e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServerResource.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.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 PostgreSQL version. + * + * @return the version value. + */ + String version(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner + * object. + * + * @return the inner object. + */ + RecoverableServerResourceInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsages.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServers.java similarity index 51% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsages.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServers.java index 2a5dc25ac53b..5290c1a9b66e 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsages.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServers.java @@ -7,31 +7,30 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of VirtualNetworkSubnetUsages. */ -public interface VirtualNetworkSubnetUsages { +/** Resource collection API of RecoverableServers. */ +public interface RecoverableServers { /** - * Get virtual network subnet usage for a given vNet resource id. + * Gets a recoverable PostgreSQL Server. * - * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating 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 virtual network subnet usage for a given vNet resource id. + * @return a recoverable PostgreSQL Server along with {@link Response}. */ - VirtualNetworkSubnetUsageResult execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); + Response getWithResponse(String resourceGroupName, String serverName, Context context); /** - * Get virtual network subnet usage for a given vNet resource id. + * Gets a recoverable PostgreSQL Server. * - * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. - * @param context The context to associate with this operation. + * @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 virtual network subnet usage for a given vNet resource id. + * @return a recoverable PostgreSQL Server. */ - Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context); + RecoverableServerResource get(String resourceGroupName, String serverName); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Replicas.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Replicas.java new file mode 100644 index 000000000000..cb0ec4c29a06 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Replicas.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Replicas. */ +public interface Replicas { + /** + * List all the replicas for 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 servers as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the replicas for 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 servers as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceIdentity.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceIdentity.java new file mode 100644 index 000000000000..5c9478da4968 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceIdentity.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.postgresqlflexibleserver.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; + + /** Creates an instance of ResourceIdentity class. */ + public ResourceIdentity() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RestartParameter.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RestartParameter.java deleted file mode 100644 index 4e4b2b3a3cdf..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RestartParameter.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Represents server restart parameters. */ -@Fluent -public final class RestartParameter { - @JsonIgnore private final ClientLogger logger = new ClientLogger(RestartParameter.class); - - /* - * Indicates whether to restart the server with failover. - */ - @JsonProperty(value = "restartWithFailover") - private Boolean restartWithFailover; - - /* - * Failover mode. - */ - @JsonProperty(value = "failoverMode") - private FailoverMode failoverMode; - - /** - * Get the restartWithFailover property: Indicates whether to restart the server with failover. - * - * @return the restartWithFailover value. - */ - public Boolean restartWithFailover() { - return this.restartWithFailover; - } - - /** - * Set the restartWithFailover property: Indicates whether to restart the server with failover. - * - * @param restartWithFailover the restartWithFailover value to set. - * @return the RestartParameter object itself. - */ - public RestartParameter withRestartWithFailover(Boolean restartWithFailover) { - this.restartWithFailover = restartWithFailover; - return this; - } - - /** - * Get the failoverMode property: Failover mode. - * - * @return the failoverMode value. - */ - public FailoverMode failoverMode() { - return this.failoverMode; - } - - /** - * Set the failoverMode property: Failover mode. - * - * @param failoverMode the failoverMode value to set. - * @return the RestartParameter object itself. - */ - public RestartParameter withFailoverMode(FailoverMode failoverMode) { - this.failoverMode = failoverMode; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SecurityAlertPolicyName.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SecurityAlertPolicyName.java new file mode 100644 index 000000000000..db9233c6afb2 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java index daf52a0c3c36..dc0d72ed8237 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java @@ -5,10 +5,10 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; import com.azure.core.management.Region; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; import java.time.OffsetDateTime; +import java.util.List; import java.util.Map; /** An immutable client-side representation of Server. */ @@ -49,18 +49,18 @@ public interface Server { Map tags(); /** - * Gets the sku property: The SKU (pricing tier) of the server. + * Gets the identity property: The Azure Active Directory identity of the server. * - * @return the sku value. + * @return the identity value. */ - Sku sku(); + ResourceIdentity identity(); /** - * Gets the systemData property: The system metadata relating to this resource. + * Gets the sku property: The SKU (pricing tier) of the server. * - * @return the systemData value. + * @return the sku value. */ - SystemData systemData(); + Sku sku(); /** * Gets the administratorLogin property: The administrator's login name of a server. Can only be specified when the @@ -71,111 +71,104 @@ public interface Server { String administratorLogin(); /** - * Gets the administratorLoginPassword property: The administrator login password (required for server creation). - * - * @return the administratorLoginPassword value. - */ - String administratorLoginPassword(); - - /** - * Gets the version property: PostgreSQL Server version. + * Gets the version property: Server version. * * @return the version value. */ ServerVersion version(); /** - * Gets the minorVersion property: The minor version of the server. + * Gets the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @return the minorVersion value. + * @return the sslEnforcement value. */ - String minorVersion(); + SslEnforcementEnum sslEnforcement(); /** - * Gets the state property: A state of a server that is visible to user. + * Gets the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the state value. + * @return the minimalTlsVersion value. */ - ServerState state(); + MinimalTlsVersionEnum minimalTlsVersion(); /** - * Gets the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * Gets the byokEnforcement property: Status showing whether the server data encryption is enabled with + * customer-managed keys. * - * @return the fullyQualifiedDomainName value. + * @return the byokEnforcement value. */ - String fullyQualifiedDomainName(); + String byokEnforcement(); /** - * Gets the storage property: Storage properties of a server. + * Gets the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @return the storage value. + * @return the infrastructureEncryption value. */ - Storage storage(); + InfrastructureEncryption infrastructureEncryption(); /** - * Gets the backup property: Backup properties of a server. + * Gets the userVisibleState property: A state of a server that is visible to user. * - * @return the backup value. + * @return the userVisibleState value. */ - Backup backup(); + ServerState userVisibleState(); /** - * Gets the network property: Network properties of a server. + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @return the network value. + * @return the fullyQualifiedDomainName value. */ - Network network(); + String fullyQualifiedDomainName(); /** - * Gets the highAvailability property: High availability properties of a server. + * Gets the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the highAvailability value. + * @return the earliestRestoreDate value. */ - HighAvailability highAvailability(); + OffsetDateTime earliestRestoreDate(); /** - * Gets the maintenanceWindow property: Maintenance window properties of a server. + * Gets the storageProfile property: Storage profile of a server. * - * @return the maintenanceWindow value. + * @return the storageProfile value. */ - MaintenanceWindow maintenanceWindow(); + StorageProfile storageProfile(); /** - * Gets the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * Gets the replicationRole property: The replication role of the server. * - * @return the sourceServerResourceId value. + * @return the replicationRole value. */ - String sourceServerResourceId(); + String replicationRole(); /** - * Gets the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore'. + * Gets the masterServerId property: The master server id of a replica server. * - * @return the pointInTimeUtc value. + * @return the masterServerId value. */ - OffsetDateTime pointInTimeUtc(); + String masterServerId(); /** - * Gets the availabilityZone property: availability zone information of the server. + * Gets the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @return the availabilityZone value. + * @return the replicaCapacity value. */ - String availabilityZone(); + Integer replicaCapacity(); /** - * Gets the createMode property: The mode to create a new PostgreSQL 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 createMode value. + * @return the publicNetworkAccess value. */ - CreateMode createMode(); + PublicNetworkAccessEnum publicNetworkAccess(); /** - * Gets the tagsPropertiesTags property: Application-specific metadata in the form of key-value pairs. + * Gets the privateEndpointConnections property: List of private endpoint connections on a server. * - * @return the tagsPropertiesTags value. + * @return the privateEndpointConnections value. */ - Map tagsPropertiesTags(); + List privateEndpointConnections(); /** * Gets the region of the resource. @@ -191,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.postgresqlflexibleserver.fluent.models.ServerInner object. * @@ -203,6 +203,7 @@ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, DefinitionStages.WithCreate { } /** The Server definition stages. */ @@ -215,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); @@ -223,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); @@ -236,27 +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.WithSku, - DefinitionStages.WithAdministratorLogin, - DefinitionStages.WithAdministratorLoginPassword, - DefinitionStages.WithVersion, - DefinitionStages.WithStorage, - DefinitionStages.WithBackup, - DefinitionStages.WithNetwork, - DefinitionStages.WithHighAvailability, - DefinitionStages.WithSourceServerResourceId, - DefinitionStages.WithPointInTimeUtc, - DefinitionStages.WithAvailabilityZone, - DefinitionStages.WithCreateMode, - DefinitionStages.WithTagsPropertiesTags { + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithSku { /** * Executes the create request. * @@ -275,149 +273,32 @@ 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); } - /** The stage of the Server definition allowing to specify sku. */ - interface WithSku { + /** The stage of the Server definition allowing to specify identity. */ + interface WithIdentity { /** - * Specifies the sku property: The SKU (pricing tier) of the server.. + * Specifies the identity property: The Azure Active Directory identity of the server.. * - * @param sku The SKU (pricing tier) of the server. + * @param identity The Azure Active Directory identity of the server. * @return the next definition stage. */ - WithCreate withSku(Sku sku); + WithCreate withIdentity(ResourceIdentity identity); } - /** 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 administrator login password (required for server - * creation).. - * - * @param administratorLoginPassword The administrator login password (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: PostgreSQL Server version.. - * - * @param version PostgreSQL Server version. - * @return the next definition stage. - */ - WithCreate withVersion(ServerVersion version); - } - /** The stage of the Server definition allowing to specify storage. */ - interface WithStorage { - /** - * Specifies the storage property: Storage properties of a server.. - * - * @param storage Storage 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 properties of a server.. - * - * @param backup Backup properties of a server. - * @return the next definition stage. - */ - WithCreate withBackup(Backup backup); - } - /** The stage of the Server definition allowing to specify network. */ - interface WithNetwork { - /** - * Specifies the network property: Network properties of a server.. - * - * @param network Network properties of a server. - * @return the next definition stage. - */ - WithCreate withNetwork(Network network); - } - /** The stage of the Server definition allowing to specify highAvailability. */ - interface WithHighAvailability { - /** - * Specifies the highAvailability property: High availability properties of a server.. - * - * @param highAvailability High availability properties of a server. - * @return the next definition stage. - */ - WithCreate withHighAvailability(HighAvailability highAvailability); - } - /** The stage of the Server definition allowing to specify sourceServerResourceId. */ - interface WithSourceServerResourceId { - /** - * Specifies the sourceServerResourceId property: The source server resource ID to restore from. It's - * required when 'createMode' is 'PointInTimeRestore'.. - * - * @param sourceServerResourceId The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. - * @return the next definition stage. - */ - WithCreate withSourceServerResourceId(String sourceServerResourceId); - } - /** The stage of the Server definition allowing to specify pointInTimeUtc. */ - interface WithPointInTimeUtc { - /** - * Specifies the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time - * to restore from. It's required when 'createMode' is 'PointInTimeRestore'.. - * - * @param pointInTimeUtc Restore point creation time (ISO8601 format), specifying the time to restore from. - * It's required when 'createMode' is 'PointInTimeRestore'. - * @return the next definition stage. - */ - WithCreate withPointInTimeUtc(OffsetDateTime pointInTimeUtc); - } - /** 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 PostgreSQL server.. - * - * @param createMode The mode to create a new PostgreSQL server. - * @return the next definition stage. - */ - WithCreate withCreateMode(CreateMode createMode); - } - /** The stage of the Server definition allowing to specify tagsPropertiesTags. */ - interface WithTagsPropertiesTags { + /** The stage of the Server definition allowing to specify sku. */ + interface WithSku { /** - * Specifies the tagsPropertiesTags property: Application-specific metadata in the form of key-value pairs.. + * Specifies the sku property: The SKU (pricing tier) of the server.. * - * @param tagsPropertiesTags Application-specific metadata in the form of key-value pairs. + * @param sku The SKU (pricing tier) of the server. * @return the next definition stage. */ - WithCreate withTagsPropertiesTags(Map tagsPropertiesTags); + WithCreate withSku(Sku sku); } } /** @@ -430,13 +311,15 @@ interface WithTagsPropertiesTags { /** The template for Server update. */ interface Update extends UpdateStages.WithTags, + UpdateStages.WithIdentity, UpdateStages.WithSku, + UpdateStages.WithStorageProfile, UpdateStages.WithAdministratorLoginPassword, - UpdateStages.WithStorage, - UpdateStages.WithBackup, - UpdateStages.WithHighAvailability, - UpdateStages.WithMaintenanceWindow, - UpdateStages.WithCreateMode { + UpdateStages.WithVersion, + UpdateStages.WithSslEnforcement, + UpdateStages.WithMinimalTlsVersion, + UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithReplicationRole { /** * Executes the update request. * @@ -464,6 +347,16 @@ interface WithTags { */ Update withTags(Map tags); } + /** The stage of the Server update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The Azure Active Directory identity of the server.. + * + * @param identity The Azure Active Directory identity of the server. + * @return the next definition stage. + */ + Update withIdentity(ResourceIdentity identity); + } /** The stage of the Server update allowing to specify sku. */ interface WithSku { /** @@ -474,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 { /** @@ -484,55 +387,57 @@ 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 properties of a server.. + * Specifies the version property: The version of a server.. * - * @param storage Storage 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 properties of a server.. + * Specifies the sslEnforcement property: Enable ssl enforcement or not when connect to server.. * - * @param backup Backup 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 properties of a server.. + * Specifies the minimalTlsVersion property: Enforce a minimal Tls version for the server.. * - * @param highAvailability High availability 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 properties 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 properties 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 createMode. */ - interface WithCreateMode { + /** The stage of the Server update allowing to specify replicationRole. */ + interface WithReplicationRole { /** - * Specifies the createMode property: The mode to update a new PostgreSQL server.. + * Specifies the replicationRole property: The replication role of the server.. * - * @param createMode The mode to update a new PostgreSQL server. + * @param replicationRole The replication role of the server. * @return the next definition stage. */ - Update withCreateMode(CreateModeForUpdate createMode); + Update withReplicationRole(String replicationRole); } } /** @@ -550,16 +455,6 @@ interface WithCreateMode { */ Server refresh(Context context); - /** - * Restarts a server. - * - * @param parameters The 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(RestartParameter parameters); - /** * Restarts a server. * @@ -571,47 +466,10 @@ interface WithCreateMode { /** * Restarts a server. * - * @param parameters The 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(RestartParameter parameters, Context context); - - /** - * Starts 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 start(); - - /** - * Starts 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 start(Context context); - - /** - * Stops 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 stop(); - - /** - * Stops 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 restart(Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResource.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResource.java new file mode 100644 index 000000000000..3527194ce1db --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResource.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import java.util.UUID; + +/** An immutable client-side representation of ServerAdministratorResource. */ +public interface ServerAdministratorResource { + /** + * 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 administratorType property: The type of administrator. + * + * @return the administratorType value. + */ + AdministratorType administratorType(); + + /** + * Gets the login property: The server administrator login account name. + * + * @return the login value. + */ + String login(); + + /** + * Gets the sid property: The server administrator Sid (Secure ID). + * + * @return the sid value. + */ + UUID sid(); + + /** + * Gets the tenantId property: The server Active Directory Administrator tenant id. + * + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner + * object. + * + * @return the inner object. + */ + ServerAdministratorResourceInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResourceListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResourceListResult.java new file mode 100644 index 000000000000..70586d7581ea --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResourceListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.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; + + /** Creates an instance of ServerAdministratorResourceListResult class. */ + public ServerAdministratorResourceListResult() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministrators.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministrators.java new file mode 100644 index 000000000000..4ce3dc96bcde --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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.postgresqlflexibleserver.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. + * @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); + + /** + * 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); + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerBasedPerformanceTiers.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerBasedPerformanceTiers.java new file mode 100644 index 000000000000..5cb684e8ee45 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.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 PostgreSQL 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 PostgreSQL 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForCreate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForCreate.java new file mode 100644 index 000000000000..91f61e214314 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForCreate.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.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; + + /** Creates an instance of ServerForCreate class. */ + public ServerForCreate() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java deleted file mode 100644 index 53b9d4eee1a6..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerPropertiesForUpdate; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Map; - -/** Represents a server to be updated. */ -@Fluent -public final class ServerForUpdate { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerForUpdate.class); - - /* - * The location the resource resides in. - */ - @JsonProperty(value = "location") - private String location; - - /* - * The SKU (pricing tier) of the server. - */ - @JsonProperty(value = "sku") - private Sku sku; - - /* - * Properties of the server. - */ - @JsonProperty(value = "properties") - private ServerPropertiesForUpdate innerProperties; - - /* - * Application-specific metadata in the form of key-value pairs. - */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) - private Map tags; - - /** - * 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 ServerForUpdate object itself. - */ - public ServerForUpdate withLocation(String location) { - this.location = location; - 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 ServerForUpdate object itself. - */ - public ServerForUpdate withSku(Sku sku) { - this.sku = sku; - return this; - } - - /** - * Get the innerProperties property: Properties of the server. - * - * @return the innerProperties value. - */ - private ServerPropertiesForUpdate innerProperties() { - return this.innerProperties; - } - - /** - * Get the tags property: Application-specific metadata in the form of key-value pairs. - * - * @return the tags value. - */ - public Map tags() { - return this.tags; - } - - /** - * Set the tags property: Application-specific metadata in the form of key-value pairs. - * - * @param tags the tags value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withTags(Map tags) { - this.tags = tags; - return this; - } - - /** - * Get the administratorLoginPassword property: The password of the administrator login. - * - * @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. - * - * @param administratorLoginPassword the administratorLoginPassword value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withAdministratorLoginPassword(String administratorLoginPassword) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); - } - this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); - return this; - } - - /** - * Get the storage property: Storage properties of a server. - * - * @return the storage value. - */ - public Storage storage() { - return this.innerProperties() == null ? null : this.innerProperties().storage(); - } - - /** - * Set the storage property: Storage properties of a server. - * - * @param storage the storage value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withStorage(Storage storage) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); - } - this.innerProperties().withStorage(storage); - return this; - } - - /** - * Get the backup property: Backup properties of a server. - * - * @return the backup value. - */ - public Backup backup() { - return this.innerProperties() == null ? null : this.innerProperties().backup(); - } - - /** - * Set the backup property: Backup properties of a server. - * - * @param backup the backup value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withBackup(Backup backup) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); - } - this.innerProperties().withBackup(backup); - return this; - } - - /** - * Get the highAvailability property: High availability properties of a server. - * - * @return the highAvailability value. - */ - public HighAvailability highAvailability() { - return this.innerProperties() == null ? null : this.innerProperties().highAvailability(); - } - - /** - * Set the highAvailability property: High availability properties of a server. - * - * @param highAvailability the highAvailability value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withHighAvailability(HighAvailability highAvailability) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); - } - this.innerProperties().withHighAvailability(highAvailability); - return this; - } - - /** - * Get the maintenanceWindow property: Maintenance window properties of a server. - * - * @return the maintenanceWindow value. - */ - public MaintenanceWindow maintenanceWindow() { - return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindow(); - } - - /** - * Set the maintenanceWindow property: Maintenance window properties of a server. - * - * @param maintenanceWindow the maintenanceWindow value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); - } - this.innerProperties().withMaintenanceWindow(maintenanceWindow); - return this; - } - - /** - * Get the createMode property: The mode to update a new PostgreSQL server. - * - * @return the createMode value. - */ - public CreateModeForUpdate createMode() { - return this.innerProperties() == null ? null : this.innerProperties().createMode(); - } - - /** - * Set the createMode property: The mode to update a new PostgreSQL server. - * - * @param createMode the createMode value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withCreateMode(CreateModeForUpdate createMode) { - if (this.innerProperties() == null) { - this.innerProperties = new ServerPropertiesForUpdate(); - } - this.innerProperties().withCreateMode(createMode); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (sku() != null) { - sku().validate(); - } - if (innerProperties() != null) { - innerProperties().validate(); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerHAState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerHAState.java deleted file mode 100644 index 60270001c020..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerHAState.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.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ServerHAState. */ -public final class ServerHAState extends ExpandableStringEnum { - /** Static value NotEnabled for ServerHAState. */ - public static final ServerHAState NOT_ENABLED = fromString("NotEnabled"); - - /** Static value CreatingStandby for ServerHAState. */ - public static final ServerHAState CREATING_STANDBY = fromString("CreatingStandby"); - - /** Static value ReplicatingData for ServerHAState. */ - public static final ServerHAState REPLICATING_DATA = fromString("ReplicatingData"); - - /** Static value FailingOver for ServerHAState. */ - public static final ServerHAState FAILING_OVER = fromString("FailingOver"); - - /** Static value Healthy for ServerHAState. */ - public static final ServerHAState HEALTHY = fromString("Healthy"); - - /** Static value RemovingStandby for ServerHAState. */ - public static final ServerHAState REMOVING_STANDBY = fromString("RemovingStandby"); - - /** - * Creates or finds a ServerHAState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ServerHAState. - */ - @JsonCreator - public static ServerHAState fromString(String name) { - return fromString(name, ServerHAState.class); - } - - /** @return known ServerHAState values. */ - public static Collection values() { - return values(ServerHAState.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKey.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKey.java new file mode 100644 index 000000000000..1a325c774b13 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyListResult.java similarity index 70% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyListResult.java index 744b0c831cdc..cda394edba88 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyListResult.java @@ -5,22 +5,18 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** location capability. */ +/** A list of PostgreSQL Server keys. */ @Immutable -public final class CapabilitiesListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(CapabilitiesListResult.class); - +public final class ServerKeyListResult { /* - * A list of supported capabilities. + * A list of PostgreSQL Server keys. */ @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) - private List value; + private List value; /* * Link to retrieve next page of results. @@ -28,12 +24,16 @@ public final class CapabilitiesListResult { @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; + /** Creates an instance of ServerKeyListResult class. */ + public ServerKeyListResult() { + } + /** - * Get the value property: A list of supported capabilities. + * Get the value property: A list of PostgreSQL Server keys. * * @return the value value. */ - public List value() { + public List value() { return this.value; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyType.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyType.java new file mode 100644 index 000000000000..3663c4f51bdf --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The key type like 'AzureKeyVault'. */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeys.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeys.java new file mode 100644 index 000000000000..82f6642808db --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of 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 PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String serverName, String keyName, Context context); + + /** + * Gets a PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key. + */ + ServerKey get(String resourceGroupName, String serverName, String keyName); + + /** + * Deletes the PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL 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 PostgreSQL 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 PostgreSQL Server key along with {@link Response}. + */ + ServerKey getById(String id); + + /** + * Gets a PostgreSQL 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 PostgreSQL Server key along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the PostgreSQL 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 PostgreSQL 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerListResult.java index cea9de78098c..d5210146a128 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerListResult.java @@ -5,31 +5,25 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** A list of servers. */ @Fluent public final class ServerListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerListResult.class); - /* - * The list of flexible servers + * The list of servers */ @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; + /** Creates an instance of ServerListResult class. */ + public ServerListResult() { + } /** - * Get the value property: The list of flexible servers. + * Get the value property: The list of servers. * * @return the value value. */ @@ -38,7 +32,7 @@ public List value() { } /** - * Set the value property: The list of flexible servers. + * Set the value property: The list of servers. * * @param value the value value to set. * @return the ServerListResult object itself. @@ -48,26 +42,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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerParameters.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerParameters.java new file mode 100644 index 000000000000..bb1604ad126b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnection.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnection.java new file mode 100644 index 000000000000..c013c07d91bf --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnection.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.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; + + /** Creates an instance of ServerPrivateEndpointConnection class. */ + public ServerPrivateEndpointConnection() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnectionProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..57547f752c40 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnectionProperties.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.postgresqlflexibleserver.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; + + /** Creates an instance of ServerPrivateEndpointConnectionProperties class. */ + public ServerPrivateEndpointConnectionProperties() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateLinkServiceConnectionStateProperty.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 000000000000..f6df38ca58de --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The 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; + + /** Creates an instance of ServerPrivateLinkServiceConnectionStateProperty class. */ + public ServerPrivateLinkServiceConnectionStateProperty() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForCreate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForCreate.java new file mode 100644 index 000000000000..7e50befdd54c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForCreate.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +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; + + /** Creates an instance of ServerPropertiesForCreate class. */ + public ServerPropertiesForCreate() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForDefaultCreate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForDefaultCreate.java new file mode 100644 index 000000000000..15f5ac7ff37b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForDefaultCreate.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import 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). + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** Creates an instance of ServerPropertiesForDefaultCreate class. */ + public ServerPropertiesForDefaultCreate() { + } + + /** + * 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). + * + * @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). + * + * @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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForGeoRestore.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForGeoRestore.java new file mode 100644 index 000000000000..ac58bc853d41 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForGeoRestore.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import 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; + + /** Creates an instance of ServerPropertiesForGeoRestore class. */ + public ServerPropertiesForGeoRestore() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForReplica.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForReplica.java new file mode 100644 index 000000000000..63ff5f6f2058 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForReplica.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import 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; + + /** Creates an instance of ServerPropertiesForReplica class. */ + public ServerPropertiesForReplica() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForRestore.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForRestore.java new file mode 100644 index 000000000000..e85e717edac7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForRestore.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.postgresqlflexibleserver.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; + + /** Creates an instance of ServerPropertiesForRestore class. */ + public ServerPropertiesForRestore() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPublicNetworkAccessState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPublicNetworkAccessState.java deleted file mode 100644 index 242ff99a99f1..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPublicNetworkAccessState.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ServerPublicNetworkAccessState. */ -public final class ServerPublicNetworkAccessState extends ExpandableStringEnum { - /** Static value Enabled for ServerPublicNetworkAccessState. */ - public static final ServerPublicNetworkAccessState ENABLED = fromString("Enabled"); - - /** Static value Disabled for ServerPublicNetworkAccessState. */ - public static final ServerPublicNetworkAccessState DISABLED = fromString("Disabled"); - - /** - * Creates or finds a ServerPublicNetworkAccessState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ServerPublicNetworkAccessState. - */ - @JsonCreator - public static ServerPublicNetworkAccessState fromString(String name) { - return fromString(name, ServerPublicNetworkAccessState.class); - } - - /** @return known ServerPublicNetworkAccessState values. */ - public static Collection values() { - return values(ServerPublicNetworkAccessState.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicies.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicies.java new file mode 100644 index 000000000000..969f142a089e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of 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. + * @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 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 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicy.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicy.java new file mode 100644 index 000000000000..e119fc5c1755 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicy.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyListResult.java new file mode 100644 index 000000000000..8eb1981dd846 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.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; + + /** Creates an instance of ServerSecurityAlertPolicyListResult class. */ + public ServerSecurityAlertPolicyListResult() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyState.java new file mode 100644 index 000000000000..a64de0660f6b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyState.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Specifies the state of the policy, whether it is enabled or disabled. */ +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) { + if (value == null) { + return null; + } + ServerSecurityAlertPolicyState[] items = ServerSecurityAlertPolicyState.values(); + for (ServerSecurityAlertPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerState.java index 4252c5056048..680fb4e0a40a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerState.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerState.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ServerState. */ +/** A state of a server that is visible to user. */ public final class ServerState extends ExpandableStringEnum { /** Static value Ready for ServerState. */ public static final ServerState READY = fromString("Ready"); @@ -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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerUpdateParameters.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerUpdateParameters.java new file mode 100644 index 000000000000..f9229e0ec39d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerUpdateParameters.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.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 ServerUpdateParameters { + /* + * 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; + + /* + * The properties that can be updated for a server. + */ + @JsonProperty(value = "properties") + private ServerUpdateParametersProperties innerProperties; + + /* + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of ServerUpdateParameters class. */ + public ServerUpdateParameters() { + } + + /** + * 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 ServerUpdateParameters object itself. + */ + public ServerUpdateParameters 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 ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the innerProperties property: The properties that can be updated for a server. + * + * @return the innerProperties value. + */ + private ServerUpdateParametersProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Application-specific metadata in the form of key-value pairs. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Application-specific metadata in the form of key-value pairs. + * + * @param tags the tags value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the storageProfile property: Storage profile of a server. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); + } + + /** + * Set the storageProfile property: Storage profile of a server. + * + * @param storageProfile the storageProfile value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withStorageProfile(StorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerUpdateParametersProperties(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @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. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withAdministratorLoginPassword(String administratorLoginPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerUpdateParametersProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the version property: The version of a server. + * + * @return the version value. + */ + public ServerVersion version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: The version of a server. + * + * @param version the version value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withVersion(ServerVersion version) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerUpdateParametersProperties(); + } + this.innerProperties().withVersion(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.innerProperties() == null ? null : this.innerProperties().sslEnforcement(); + } + + /** + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @param sslEnforcement the sslEnforcement value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withSslEnforcement(SslEnforcementEnum sslEnforcement) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerUpdateParametersProperties(); + } + this.innerProperties().withSslEnforcement(sslEnforcement); + return this; + } + + /** + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); + } + + /** + * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerUpdateParametersProperties(); + } + this.innerProperties().withMinimalTlsVersion(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.innerProperties() == null ? null : this.innerProperties().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 ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerUpdateParametersProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the replicationRole property: The replication role of the server. + * + * @return the replicationRole value. + */ + public String replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); + } + + /** + * Set the replicationRole property: The replication role of the server. + * + * @param replicationRole the replicationRole value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withReplicationRole(String replicationRole) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerUpdateParametersProperties(); + } + this.innerProperties().withReplicationRole(replicationRole); + 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 (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java index 898b4c14cb99..224bac74b3cb 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java @@ -8,13 +8,22 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ServerVersion. */ +/** The version of a server. */ public final class ServerVersion extends ExpandableStringEnum { - /** Static value 13 for ServerVersion. */ - public static final ServerVersion ONE_THREE = fromString("13"); + /** Static value 9.5 for ServerVersion. */ + public static final ServerVersion NINE_FIVE = fromString("9.5"); - /** Static value 12 for ServerVersion. */ - public static final ServerVersion ONE_TWO = fromString("12"); + /** Static value 9.6 for ServerVersion. */ + public static final ServerVersion NINE_SIX = fromString("9.6"); + + /** Static value 10 for ServerVersion. */ + public static final ServerVersion ONE_ZERO = fromString("10"); + + /** Static value 10.0 for ServerVersion. */ + public static final ServerVersion ONE_ZERO_ZERO = fromString("10.0"); + + /** Static value 10.2 for ServerVersion. */ + public static final ServerVersion ONE_ZERO_TWO = fromString("10.2"); /** Static value 11 for ServerVersion. */ public static final ServerVersion ONE_ONE = fromString("11"); @@ -30,7 +39,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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java deleted file mode 100644 index 802ba6973d7e..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Server version capabilities. */ -@Immutable -public final class ServerVersionCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVersionCapability.class); - - /* - * server version - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The supportedVcores property. - */ - @JsonProperty(value = "supportedVcores", access = JsonProperty.Access.WRITE_ONLY) - private List supportedVcores; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: server version. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedVcores property: The supportedVcores property. - * - * @return the supportedVcores value. - */ - public List supportedVcores() { - return this.supportedVcores; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedVcores() != null) { - supportedVcores().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Servers.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Servers.java index 22598f8e0f67..976b05375bd2 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Servers.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Servers.java @@ -38,25 +38,25 @@ public interface Servers { * * @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 server. + * @return information about a server along with {@link Response}. */ - Server getByResourceGroup(String resourceGroupName, String serverName); + Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, Context context); /** * Gets information about 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 information about a server. */ - Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, Context context); + Server getByResourceGroup(String resourceGroupName, String serverName); /** * List all the servers in a given resource group. @@ -65,7 +65,7 @@ public interface Servers { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName); @@ -77,7 +77,7 @@ public interface Servers { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName, Context context); @@ -86,7 +86,7 @@ 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. - * @return a list of servers. + * @return a list of servers as paginated response with {@link PagedIterable}. */ PagedIterable list(); @@ -97,22 +97,10 @@ public interface Servers { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); - /** - * Restarts a 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 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, RestartParameter parameters); - /** * Restarts a server. * @@ -129,59 +117,12 @@ public interface Servers { * * @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 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, RestartParameter parameters, Context context); - - /** - * Starts 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. - */ - void start(String resourceGroupName, String serverName); - - /** - * Starts 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. - */ - void start(String resourceGroupName, String serverName, Context context); - - /** - * Stops 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. - */ - void stop(String resourceGroupName, String serverName); - - /** - * Stops 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. - */ - void stop(String resourceGroupName, String serverName, Context context); + void restart(String resourceGroupName, String serverName, Context context); /** * Gets information about a server. @@ -190,7 +131,7 @@ public interface Servers { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 server. + * @return information about a server along with {@link Response}. */ Server getById(String id); @@ -202,7 +143,7 @@ public interface Servers { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 server. + * @return information about a server along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Sku.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Sku.java index 9e050e0b8222..e5d3b1be5054 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Sku.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Sku.java @@ -6,29 +6,47 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -/** Sku information related properties of a server. */ +/** Billing information related properties of a server. */ @Fluent public final class Sku { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); - /* - * The name of the sku, typically, tier + family + cores, e.g. - * Standard_D4s_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. Burstable. + * 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; + + /** Creates an instance of Sku class. */ + public Sku() { + } + /** - * Get the name property: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_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. */ @@ -37,7 +55,7 @@ public String name() { } /** - * Set the name property: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_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. @@ -48,7 +66,7 @@ public Sku withName(String name) { } /** - * Get the tier property: The tier of the particular SKU, e.g. Burstable. + * Get the tier property: The tier of the particular SKU, e.g. Basic. * * @return the tier value. */ @@ -57,7 +75,7 @@ public SkuTier tier() { } /** - * Set the tier property: The tier of the particular SKU, e.g. Burstable. + * 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. @@ -67,6 +85,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. * @@ -74,12 +152,10 @@ public Sku withTier(SkuTier tier) { */ public void validate() { if (name() == null) { - throw logger + 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SkuTier.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SkuTier.java index 0c6c06a9d03d..5df5685b6572 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SkuTier.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SkuTier.java @@ -8,10 +8,10 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for SkuTier. */ +/** The tier of the particular SKU, e.g. Basic. */ 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SslEnforcementEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SslEnforcementEnum.java new file mode 100644 index 000000000000..9617988d7f04 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SslEnforcementEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Enable ssl enforcement or not when connect to server. */ +public enum SslEnforcementEnum { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SslEnforcementEnum instance. */ + private final String value; + + SslEnforcementEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SslEnforcementEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed SslEnforcementEnum object, or null if unable to parse. + */ + @JsonCreator + public static SslEnforcementEnum fromString(String value) { + if (value == null) { + return null; + } + SslEnforcementEnum[] items = SslEnforcementEnum.values(); + for (SslEnforcementEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.java deleted file mode 100644 index e883de3b7446..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.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.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Storage properties of a server. */ -@Fluent -public final class Storage { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Storage.class); - - /* - * Max storage allowed for a server. - */ - @JsonProperty(value = "storageSizeGB") - private Integer storageSizeGB; - - /** - * Get the storageSizeGB property: Max storage allowed for a server. - * - * @return the storageSizeGB value. - */ - public Integer storageSizeGB() { - return this.storageSizeGB; - } - - /** - * Set the storageSizeGB property: Max storage 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; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutogrow.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutogrow.java new file mode 100644 index 000000000000..63061fa29991 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enable Storage Auto Grow. */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java deleted file mode 100644 index e0d7e05cfe7e..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** storage edition capability. */ -@Immutable -public final class StorageEditionCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageEditionCapability.class); - - /* - * storage edition name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The supportedStorageMB property. - */ - @JsonProperty(value = "supportedStorageMB", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageMB; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: storage edition name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedStorageMB property: The supportedStorageMB property. - * - * @return the supportedStorageMB value. - */ - public List supportedStorageMB() { - return this.supportedStorageMB; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedStorageMB() != null) { - supportedStorageMB().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMBCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMBCapability.java deleted file mode 100644 index e6477236c257..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMBCapability.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** storage size in MB capability. */ -@Immutable -public final class StorageMBCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageMBCapability.class); - - /* - * storage MB name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * supported IOPS - */ - @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedIops; - - /* - * storage size in MB - */ - @JsonProperty(value = "storageSizeMB", access = JsonProperty.Access.WRITE_ONLY) - private Long storageSizeMB; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: storage MB name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedIops property: supported IOPS. - * - * @return the supportedIops value. - */ - public Long supportedIops() { - return this.supportedIops; - } - - /** - * Get the storageSizeMB property: storage size in MB. - * - * @return the storageSizeMB value. - */ - public Long storageSizeMB() { - return this.storageSizeMB; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageProfile.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageProfile.java new file mode 100644 index 000000000000..dd54a0e1eb19 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageProfile.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** 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; + + /** Creates an instance of StorageProfile class. */ + public StorageProfile() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/TagsObject.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/TagsObject.java new file mode 100644 index 000000000000..c5b974328229 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/TagsObject.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.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; + + /** Creates an instance of TagsObject class. */ + public TagsObject() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VcoreCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VcoreCapability.java deleted file mode 100644 index fc1806c08cff..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VcoreCapability.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Vcores capability. */ -@Immutable -public final class VcoreCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(VcoreCapability.class); - - /* - * vCore name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * supported vCores - */ - @JsonProperty(value = "vCores", access = JsonProperty.Access.WRITE_ONLY) - private Long vCores; - - /* - * supported IOPS - */ - @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedIops; - - /* - * supported memory per vCore in MB - */ - @JsonProperty(value = "supportedMemoryPerVcoreMB", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedMemoryPerVcoreMB; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: vCore name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the vCores property: supported vCores. - * - * @return the vCores value. - */ - public Long vCores() { - return this.vCores; - } - - /** - * Get the supportedIops property: supported IOPS. - * - * @return the supportedIops value. - */ - public Long supportedIops() { - return this.supportedIops; - } - - /** - * Get the supportedMemoryPerVcoreMB property: supported memory per vCore in MB. - * - * @return the supportedMemoryPerVcoreMB value. - */ - public Long supportedMemoryPerVcoreMB() { - return this.supportedMemoryPerVcoreMB; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRule.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRule.java new file mode 100644 index 000000000000..fbefcba0039f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.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.postgresqlflexibleserver.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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleListResult.java new file mode 100644 index 000000000000..cc866814af3f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.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; + + /** Creates an instance of VirtualNetworkRuleListResult class. */ + public VirtualNetworkRuleListResult() { + } + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleState.java new file mode 100644 index 000000000000..f7488980d1e0 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Virtual Network Rule State. */ +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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRules.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRules.java new file mode 100644 index 000000000000..4a24f47b2a17 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of 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. + * @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); + + /** + * 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); + + /** + * 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java deleted file mode 100644 index b76dce3dfce5..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.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.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Virtual network subnet usage parameter. */ -@Fluent -public final class VirtualNetworkSubnetUsageParameter { - @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkSubnetUsageParameter.class); - - /* - * Virtual network resource id. - */ - @JsonProperty(value = "virtualNetworkArmResourceId") - private String virtualNetworkArmResourceId; - - /** - * Get the virtualNetworkArmResourceId property: Virtual network resource id. - * - * @return the virtualNetworkArmResourceId value. - */ - public String virtualNetworkArmResourceId() { - return this.virtualNetworkArmResourceId; - } - - /** - * Set the virtualNetworkArmResourceId property: Virtual network resource id. - * - * @param virtualNetworkArmResourceId the virtualNetworkArmResourceId value to set. - * @return the VirtualNetworkSubnetUsageParameter object itself. - */ - public VirtualNetworkSubnetUsageParameter withVirtualNetworkArmResourceId(String virtualNetworkArmResourceId) { - this.virtualNetworkArmResourceId = virtualNetworkArmResourceId; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java deleted file mode 100644 index 40385f3db533..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.models; - -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import java.util.List; - -/** An immutable client-side representation of VirtualNetworkSubnetUsageResult. */ -public interface VirtualNetworkSubnetUsageResult { - /** - * Gets the delegatedSubnetsUsage property: The delegatedSubnetsUsage property. - * - * @return the delegatedSubnetsUsage value. - */ - List delegatedSubnetsUsage(); - - /** - * Gets the inner - * com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner object. - * - * @return the inner object. - */ - VirtualNetworkSubnetUsageResultInner innerModel(); -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java index 7da11dd156e8..cff550aaf5d6 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/CheckNameAvailabilityExecuteSamples.java @@ -10,7 +10,7 @@ /** Samples for CheckNameAvailability Execute. */ public final class CheckNameAvailabilityExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/CheckNameAvailability.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/CheckNameAvailability.json */ /** * Sample code: NameAvailability. @@ -21,7 +21,6 @@ public static void nameAvailability(com.azure.resourcemanager.postgresqlflexible manager .checkNameAvailabilities() .executeWithResponse( - new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforPostgreSQL/flexibleServers"), - Context.NONE); + new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforPostgreSQL"), Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsCreateOrUpdateSamples.java similarity index 58% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutSamples.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsCreateOrUpdateSamples.java index 7d89dfa0b476..4d5b8e440bb3 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsPutSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsCreateOrUpdateSamples.java @@ -4,23 +4,23 @@ package com.azure.resourcemanager.postgresqlflexibleserver.generated; -/** Samples for Configurations Put. */ -public final class ConfigurationsPutSamples { +/** Samples for Configurations CreateOrUpdate. */ +public final class ConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json */ /** - * Sample code: Update a user configuration. + * Sample code: ConfigurationCreateOrUpdate. * * @param manager Entry point to PostgreSqlManager. */ - public static void updateAUserConfiguration( + public static void configurationCreateOrUpdate( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager .configurations() - .define("event_scheduler") - .withExistingFlexibleServer("testrg", "testserver") - .withValue("on") + .define("array_nulls") + .withExistingServer("TestGroup", "testserver") + .withValue("off") .withSource("user-override") .create(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetSamples.java index 03d75baa89ba..6ee2f3b94ad6 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsGetSamples.java @@ -9,7 +9,7 @@ /** Samples for Configurations Get. */ public final class ConfigurationsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json */ /** * Sample code: ConfigurationGet. @@ -17,6 +17,6 @@ public final class ConfigurationsGetSamples { * @param manager Entry point to PostgreSqlManager. */ public static void configurationGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.configurations().getWithResponse("testrg", "testserver", "array_nulls", Context.NONE); + manager.configurations().getWithResponse("TestGroup", "testserver", "array_nulls", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java index dfd7b2e7214f..b2578df2b335 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsListByServerSamples.java @@ -9,7 +9,7 @@ /** Samples for Configurations ListByServer. */ public final class ConfigurationsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationListByServer.json */ /** * Sample code: ConfigurationList. @@ -17,6 +17,6 @@ public final class ConfigurationsListByServerSamples { * @param manager Entry point to PostgreSqlManager. */ public static void configurationList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.configurations().listByServer("testrg", "testserver", Context.NONE); + manager.configurations().listByServer("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateOrUpdateSamples.java similarity index 51% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateSamples.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateOrUpdateSamples.java index bcfb685e4aad..19689ff2e2fd 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesCreateOrUpdateSamples.java @@ -4,23 +4,23 @@ package com.azure.resourcemanager.postgresqlflexibleserver.generated; -/** Samples for Databases Create. */ -public final class DatabasesCreateSamples { +/** Samples for Databases CreateOrUpdate. */ +public final class DatabasesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/DatabaseCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate.json */ /** - * Sample code: Create a database. + * Sample code: DatabaseCreate. * * @param manager Entry point to PostgreSqlManager. */ - public static void createADatabase(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + public static void databaseCreate(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager .databases() .define("db1") - .withExistingFlexibleServer("TestGroup", "testserver") - .withCharset("utf8") - .withCollation("en_US.utf8") + .withExistingServer("TestGroup", "testserver") + .withCharset("UTF8") + .withCollation("English_United States.1252") .create(); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteSamples.java index d661207dc5b3..16040a6cdf08 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesDeleteSamples.java @@ -9,14 +9,14 @@ /** Samples for Databases Delete. */ public final class DatabasesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/DatabaseDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseDelete.json */ /** - * Sample code: Delete a database. + * Sample code: DatabaseDelete. * * @param manager Entry point to PostgreSqlManager. */ - public static void deleteADatabase(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + public static void databaseDelete(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager.databases().delete("TestGroup", "testserver", "db1", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetSamples.java index 60d182dc2125..82a7320737f4 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesGetSamples.java @@ -9,14 +9,14 @@ /** Samples for Databases Get. */ public final class DatabasesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/DatabaseGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json */ /** - * Sample code: Get a database. + * Sample code: DatabaseGet. * * @param manager Entry point to PostgreSqlManager. */ - public static void getADatabase(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + public static void databaseGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager.databases().getWithResponse("TestGroup", "testserver", "db1", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerSamples.java index 10c9e4bb162f..f9135f66ff87 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/DatabasesListByServerSamples.java @@ -9,15 +9,14 @@ /** Samples for Databases ListByServer. */ public final class DatabasesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/DatabasesListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseListByServer.json */ /** - * Sample code: List databases in a server. + * Sample code: DatabaseList. * * @param manager Entry point to PostgreSqlManager. */ - public static void listDatabasesInAServer( - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + public static void databaseList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager.databases().listByServer("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java index 54f642ff13ae..e2df984ed605 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesCreateOrUpdateSamples.java @@ -7,7 +7,7 @@ /** Samples for FirewallRules CreateOrUpdate. */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/FirewallRuleCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate.json */ /** * Sample code: FirewallRuleCreate. @@ -19,7 +19,7 @@ public static void firewallRuleCreate( manager .firewallRules() .define("rule1") - .withExistingFlexibleServer("testrg", "testserver") + .withExistingServer("TestGroup", "testserver") .withStartIpAddress("0.0.0.0") .withEndIpAddress("255.255.255.255") .create(); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java index 9ea95e6cd278..c213e7587965 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesDeleteSamples.java @@ -9,7 +9,7 @@ /** Samples for FirewallRules Delete. */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/FirewallRuleDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleDelete.json */ /** * Sample code: FirewallRuleDelete. @@ -18,6 +18,6 @@ public final class FirewallRulesDeleteSamples { */ public static void firewallRuleDelete( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.firewallRules().delete("testrg", "testserver", "rule1", Context.NONE); + manager.firewallRules().delete("TestGroup", "testserver", "rule1", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetSamples.java index b24694310817..b8824df75a40 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesGetSamples.java @@ -9,14 +9,14 @@ /** Samples for FirewallRules Get. */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/FirewallRuleGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json */ /** - * Sample code: FirewallRuleList. + * Sample code: FirewallRuleGet. * * @param manager Entry point to PostgreSqlManager. */ - public static void firewallRuleList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.firewallRules().getWithResponse("testrg", "testserver", "rule1", Context.NONE); + public static void firewallRuleGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.firewallRules().getWithResponse("TestGroup", "testserver", "rule1", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java index d5958d2ffb44..b75fa4554f2e 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/FirewallRulesListByServerSamples.java @@ -9,7 +9,7 @@ /** Samples for FirewallRules ListByServer. */ public final class FirewallRulesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/FirewallRuleListByServer.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleListByServer.json */ /** * Sample code: FirewallRuleList. @@ -17,6 +17,6 @@ public final class FirewallRulesListByServerSamples { * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.firewallRules().listByServer("testrg", "testserver", Context.NONE); + manager.firewallRules().listByServer("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java deleted file mode 100644 index 5294790fb72f..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedCapabilitiesExecuteSamples.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.Context; - -/** Samples for LocationBasedCapabilities Execute. */ -public final class LocationBasedCapabilitiesExecuteSamples { - /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/CapabilitiesByLocation.json - */ - /** - * Sample code: CapabilitiesList. - * - * @param manager Entry point to PostgreSqlManager. - */ - public static void capabilitiesList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.locationBasedCapabilities().execute("westus", Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedPerformanceTierListSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedPerformanceTierListSamples.java new file mode 100644 index 000000000000..920ab8ff88a9 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LocationBasedPerformanceTierListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for LocationBasedPerformanceTier List. */ +public final class LocationBasedPerformanceTierListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByLocation.json + */ + /** + * Sample code: PerformanceTiersList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void performanceTiersList( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.locationBasedPerformanceTiers().list("WestUS", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LogFilesListByServerSamples.java similarity index 57% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartSamples.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LogFilesListByServerSamples.java index 1c67ddf3d592..11af59e26fa4 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStartSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/LogFilesListByServerSamples.java @@ -6,17 +6,17 @@ import com.azure.core.util.Context; -/** Samples for Servers Start. */ -public final class ServersStartSamples { +/** Samples for LogFiles ListByServer. */ +public final class LogFilesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerStart.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/LogFileListByServer.json */ /** - * Sample code: ServerStart. + * Sample code: LogFileList. * * @param manager Entry point to PostgreSqlManager. */ - public static void serverStart(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().start("testrg", "testserver", Context.NONE); + public static void logFileList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.logFiles().listByServer("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListSamples.java index 80530532cf9d..b514f81f8146 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/OperationsListSamples.java @@ -9,7 +9,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/OperationList.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/OperationList.json */ /** * Sample code: OperationList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..c51bfc60ad47 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 PostgreSqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 000000000000..896f959c3560 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .privateEndpointConnections() + .delete("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 000000000000..3369bf191a16 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsListByServerSamples.java new file mode 100644 index 000000000000..821fe5b7c8df --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByServer. */ +public final class PrivateEndpointConnectionsListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsUpdateTagsSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateEndpointConnectionsUpdateTagsSamples.java new file mode 100644 index 000000000000..2f9b4fbec405 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnection; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateEndpointConnections UpdateTags. */ +public final class PrivateEndpointConnectionsUpdateTagsSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json + */ + /** + * Sample code: Update private endpoint connection Tags. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updatePrivateEndpointConnectionTags( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + PrivateEndpointConnection resource = + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "val1", "key2", "val2", "key3", "val3")).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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateLinkResourcesGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 000000000000..693da9e59eba --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for PostgreSQL. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getsAPrivateLinkResourceForPostgreSQL( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateLinkResourcesListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/PrivateLinkResourcesListByServerSamples.java new file mode 100644 index 000000000000..246de5e3f6a9 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByServer. */ +public final class PrivateLinkResourcesListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for PostgreSQL. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getsPrivateLinkResourcesForPostgreSQL( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/RecoverableServersGetSamples.java similarity index 58% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/RecoverableServersGetSamples.java index 1535472d6cc3..fe735412b937 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/GetPrivateDnsZoneSuffixExecuteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/RecoverableServersGetSamples.java @@ -6,18 +6,18 @@ import com.azure.core.util.Context; -/** Samples for GetPrivateDnsZoneSuffix Execute. */ -public final class GetPrivateDnsZoneSuffixExecuteSamples { +/** Samples for RecoverableServers Get. */ +public final class RecoverableServersGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/GetPrivateDnsZoneSuffix.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/RecoverableServersGet.json */ /** - * Sample code: GetPrivateDnsZoneSuffix. + * Sample code: ReplicasListByServer. * * @param manager Entry point to PostgreSqlManager. */ - public static void getPrivateDnsZoneSuffix( + public static void replicasListByServer( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.getPrivateDnsZoneSuffixes().executeWithResponse(Context.NONE); + manager.recoverableServers().getWithResponse("testrg", "pgtestsvc4", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ReplicasListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ReplicasListByServerSamples.java new file mode 100644 index 000000000000..e888f89c407c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ReplicasListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for Replicas ListByServer. */ +public final class ReplicasListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ReplicasListByServer.json + */ + /** + * Sample code: ReplicasListByServer. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void replicasListByServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.replicas().listByServer("TestGroup_WestCentralUS", "testserver-master", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsCreateOrUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..7386144851d5 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsCreateOrUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.AdministratorType; +import java.util.UUID; + +/** Samples for ServerAdministrators CreateOrUpdate. */ +public final class ServerAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json + */ + /** + * Sample code: ServerAdministratorCreate. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverAdministratorCreate( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .serverAdministrators() + .createOrUpdate( + "testrg", + "pgtestsvc4", + 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsDeleteSamples.java new file mode 100644 index 000000000000..eebbf2ad2f45 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdministrators Delete. */ +public final class ServerAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminDelete.json + */ + /** + * Sample code: ServerAdministratorsDelete. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverAdministratorsDelete( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverAdministrators().delete("testrg", "pgtestsvc4", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsGetSamples.java new file mode 100644 index 000000000000..a6910bc13fba --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdministrators Get. */ +public final class ServerAdministratorsGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminGet.json + */ + /** + * Sample code: ServerAdministratorGet. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void serverAdministratorGet( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverAdministrators().getWithResponse("testrg", "pgtestsvc4", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsListSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerAdministratorsListSamples.java new file mode 100644 index 000000000000..408e04b89b78 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdministrators List. */ +public final class ServerAdministratorsListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminList.json + */ + /** + * Sample code: get a list of server administrators. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getAListOfServerAdministrators( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverAdministrators().list("testrg", "pgtestsvc4", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBasedPerformanceTierListSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBasedPerformanceTierListSamples.java new file mode 100644 index 000000000000..ad2ace9d45b1 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerBasedPerformanceTierListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerBasedPerformanceTier List. */ +public final class ServerBasedPerformanceTierListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json + */ + /** + * Sample code: PerformanceTiersList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void performanceTiersList( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverBasedPerformanceTiers().list("TestGroup", "testserver", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysCreateOrUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysCreateOrUpdateSamples.java new file mode 100644 index 000000000000..d937d7d7e0d4 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeyType; + +/** Samples for ServerKeys CreateOrUpdate. */ +public final class ServerKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a PostgreSQL Server key. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createsOrUpdatesAPostgreSQLServerKey( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysDeleteSamples.java new file mode 100644 index 000000000000..d100690cc168 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys Delete. */ +public final class ServerKeysDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyDelete.json + */ + /** + * Sample code: Delete the PostgreSQL Server key. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void deleteThePostgreSQLServerKey( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .serverKeys() + .delete("testserver", "someVault_someKey_01234567890123456789012345678901", "testrg", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysGetSamples.java new file mode 100644 index 000000000000..8be88f22b607 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysGetSamples.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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys Get. */ +public final class ServerKeysGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json + */ + /** + * Sample code: Get the PostgreSQL Server key. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getThePostgreSQLServerKey( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .serverKeys() + .getWithResponse( + "testrg", "testserver", "someVault_someKey_01234567890123456789012345678901", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysListSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysListSamples.java new file mode 100644 index 000000000000..d232c2f25f0a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerKeysListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys List. */ +public final class ServerKeysListSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyList.json + */ + /** + * Sample code: List the keys for a PostgreSQL Server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listTheKeysForAPostgreSQLServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverKeys().list("testrg", "testserver", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerParametersListUpdateConfigurationsSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerParametersListUpdateConfigurationsSamples.java new file mode 100644 index 000000000000..95e005ab9ede --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; + +/** Samples for ServerParameters ListUpdateConfigurations. */ +public final class ServerParametersListUpdateConfigurationsSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json + */ + /** + * Sample code: ConfigurationList. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void configurationList(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .serverParameters() + .listUpdateConfigurations("TestGroup", "testserver", new ConfigurationListResultInner(), Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..59a5891bd41b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicy; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicyState; +import java.util.Arrays; + +/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json + */ + /** + * Sample code: Update a server's threat detection policy with minimal parameters. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json + */ + /** + * Sample code: Update a server's threat detection policy with all parameters. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerSecurityAlertPoliciesGetSamples.java similarity index 50% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsUpdateSamples.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerSecurityAlertPoliciesGetSamples.java index 2b2c5a030817..af98d8acab09 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ConfigurationsUpdateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerSecurityAlertPoliciesGetSamples.java @@ -5,25 +5,22 @@ package com.azure.resourcemanager.postgresqlflexibleserver.generated; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; -/** Samples for Configurations Update. */ -public final class ConfigurationsUpdateSamples { +/** Samples for ServerSecurityAlertPolicies Get. */ +public final class ServerSecurityAlertPoliciesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json */ /** - * Sample code: Update a user configuration. + * Sample code: Get a server's threat detection policy. * * @param manager Entry point to PostgreSqlManager. */ - public static void updateAUserConfiguration( + public static void getAServerSThreatDetectionPolicy( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - Configuration resource = - manager - .configurations() - .getWithResponse("testrg", "testserver", "event_scheduler", Context.NONE) - .getValue(); - resource.update().withValue("on").withSource("user-override").apply(); + manager + .serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerSecurityAlertPoliciesListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServerSecurityAlertPoliciesListByServerSamples.java new file mode 100644 index 000000000000..adab9e947dbf --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerSecurityAlertPolicies ListByServer. */ +public final class ServerSecurityAlertPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json + */ + /** + * Sample code: List the server's threat detection policies. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listTheServerSThreatDetectionPolicies( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersCreateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersCreateSamples.java index 35fd44375212..45ad7f7a95d9 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersCreateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersCreateSamples.java @@ -4,16 +4,16 @@ package com.azure.resourcemanager.postgresqlflexibleserver.generated; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.GeoRedundantBackupEnum; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailabilityMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Network; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; +import com.azure.resourcemanager.postgresqlflexibleserver.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForDefaultCreate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForGeoRestore; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForReplica; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForRestore; import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageProfile; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; @@ -21,7 +21,56 @@ /** Samples for Servers Create. */ public final class ServersCreateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerCreate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json + */ + /** + * Sample code: Create a replica server. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createAReplicaServer( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .servers() + .define("testserver-replica1") + .withRegion("westcentralus") + .withExistingResourceGroup("TestGroup_WestCentralUS") + .withProperties( + new ServerPropertiesForReplica() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")) + .withSku( + new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) + .create(); + } + + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json + */ + /** + * Sample code: Create a server as a geo restore. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createAServerAsAGeoRestore( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager + .servers() + .define("targetserver") + .withRegion("westus") + .withExistingResourceGroup("TargetResourceGroup") + .withProperties( + new ServerPropertiesForGeoRestore() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/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/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json */ /** * Sample code: Create a new server. @@ -33,28 +82,25 @@ public static void createANewServer(com.azure.resourcemanager.postgresqlflexible .servers() .define("pgtestsvc4") .withRegion("westus") - .withExistingResourceGroup("testrg") + .withExistingResourceGroup("TestGroup") + .withProperties( + new ServerPropertiesForDefaultCreate() + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .withStorageProfile( + new StorageProfile() + .withBackupRetentionDays(7) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(128000)) + .withAdministratorLogin("cloudsa") + .withAdministratorLoginPassword("fakeTokenPlaceholder")) .withTags(mapOf("ElasticServer", "1")) - .withSku(new Sku().withName("Standard_D4s_v3").withTier(SkuTier.GENERAL_PURPOSE)) - .withAdministratorLogin("cloudsa") - .withAdministratorLoginPassword("password") - .withVersion(ServerVersion.ONE_TWO) - .withStorage(new Storage().withStorageSizeGB(512)) - .withBackup(new Backup().withBackupRetentionDays(7).withGeoRedundantBackup(GeoRedundantBackupEnum.DISABLED)) - .withNetwork( - new Network() - .withDelegatedSubnetResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet") - .withPrivateDnsZoneArmResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com")) - .withHighAvailability(new HighAvailability().withMode(HighAvailabilityMode.ZONE_REDUNDANT)) - .withAvailabilityZone("1") - .withCreateMode(CreateMode.CREATE) + .withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).withCapacity(2).withFamily("Gen5")) .create(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerCreatePointInTimeRestore.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json */ /** * Sample code: Create a database as a point in time restore. @@ -65,13 +111,16 @@ public static void createADatabaseAsAPointInTimeRestore( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager .servers() - .define("pgtestsvc5") - .withRegion("westus") - .withExistingResourceGroup("testrg") - .withSourceServerResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername") - .withPointInTimeUtc(OffsetDateTime.parse("2021-06-27T00:04:59.4078005+00:00")) - .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .define("targetserver") + .withRegion("brazilsouth") + .withExistingResourceGroup("TargetResourceGroup") + .withProperties( + new ServerPropertiesForRestore() + .withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver") + .withRestorePointInTime(OffsetDateTime.parse("2017-12-14T00:00:37.467Z"))) + .withTags(mapOf("ElasticServer", "1")) + .withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).withCapacity(2).withFamily("Gen5")) .create(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteSamples.java index 592c7b545b21..e66241a71887 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersDeleteSamples.java @@ -9,7 +9,7 @@ /** Samples for Servers Delete. */ public final class ServersDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerDelete.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerDelete.json */ /** * Sample code: ServerDelete. @@ -17,6 +17,6 @@ public final class ServersDeleteSamples { * @param manager Entry point to PostgreSqlManager. */ public static void serverDelete(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().delete("testrg", "testserver", Context.NONE); + manager.servers().delete("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java index b74a5b1bd145..3acf32e52ada 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersGetByResourceGroupSamples.java @@ -9,7 +9,7 @@ /** Samples for Servers GetByResourceGroup. */ public final class ServersGetByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerGet.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json */ /** * Sample code: ServerGet. @@ -19,16 +19,4 @@ public final class ServersGetByResourceGroupSamples { public static void serverGet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc1", Context.NONE); } - - /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerGetWithVnet.json - */ - /** - * Sample code: ServerGetWithVnet. - * - * @param manager Entry point to PostgreSqlManager. - */ - public static void serverGetWithVnet(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc4", Context.NONE); - } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java index dd3ed3d991c2..368a2c501990 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListByResourceGroupSamples.java @@ -9,7 +9,7 @@ /** Samples for Servers ListByResourceGroup. */ public final class ServersListByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerListByResourceGroup.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerListByResourceGroup.json */ /** * Sample code: ServerListByResourceGroup. @@ -18,6 +18,6 @@ public final class ServersListByResourceGroupSamples { */ public static void serverListByResourceGroup( com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().listByResourceGroup("testrg", Context.NONE); + manager.servers().listByResourceGroup("TestGroup", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListSamples.java index 1ac9fbb25fa8..1846c3a87a11 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersListSamples.java @@ -9,7 +9,7 @@ /** Samples for Servers List. */ public final class ServersListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerList.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerList.json */ /** * Sample code: ServerList. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartSamples.java index 6dbfe9290219..cbd08fca331c 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersRestartSamples.java @@ -5,13 +5,11 @@ package com.azure.resourcemanager.postgresqlflexibleserver.generated; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FailoverMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; /** Samples for Servers Restart. */ public final class ServersRestartSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerRestart.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerRestart.json */ /** * Sample code: ServerRestart. @@ -19,25 +17,6 @@ public final class ServersRestartSamples { * @param manager Entry point to PostgreSqlManager. */ public static void serverRestart(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().restart("testrg", "testserver", null, Context.NONE); - } - - /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerRestartWithFailover.json - */ - /** - * Sample code: ServerRestartWithFailover. - * - * @param manager Entry point to PostgreSqlManager. - */ - public static void serverRestartWithFailover( - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager - .servers() - .restart( - "testrg", - "testserver", - new RestartParameter().withRestartWithFailover(true).withFailoverMode(FailoverMode.FORCED_FAILOVER), - Context.NONE); + manager.servers().restart("TestGroup", "testserver", Context.NONE); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopSamples.java deleted file mode 100644 index 03f53081b145..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersStopSamples.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.Context; - -/** Samples for Servers Stop. */ -public final class ServersStopSamples { - /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerStop.json - */ - /** - * Sample code: ServerStop. - * - * @param manager Entry point to PostgreSqlManager. - */ - public static void serverStop(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager.servers().stop("testrg", "testserver", Context.NONE); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersUpdateSamples.java index 1c37b19c022f..6c3e4c7b13c9 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersUpdateSamples.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/ServersUpdateSamples.java @@ -5,18 +5,14 @@ package com.azure.resourcemanager.postgresqlflexibleserver.generated; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForUpdate; -import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; -import com.azure.resourcemanager.postgresqlflexibleserver.models.SkuTier; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; /** Samples for Servers Update. */ public final class ServersUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerUpdate.json + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerUpdate.json */ /** * Sample code: ServerUpdate. @@ -24,39 +20,13 @@ public final class ServersUpdateSamples { * @param manager Entry point to PostgreSqlManager. */ public static void serverUpdate(com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - Server resource = - manager.servers().getByResourceGroupWithResponse("TestGroup", "pgtestsvc4", Context.NONE).getValue(); - resource - .update() - .withSku(new Sku().withName("Standard_D8s_v3").withTier(SkuTier.GENERAL_PURPOSE)) - .withAdministratorLoginPassword("newpassword") - .withStorage(new Storage().withStorageSizeGB(1024)) - .withBackup(new Backup().withBackupRetentionDays(20)) - .withCreateMode(CreateModeForUpdate.UPDATE) - .apply(); - } - - /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerUpdateWithCustomerMaintenanceWindow.json - */ - /** - * Sample code: ServerUpdateWithCustomerMaintenanceWindow. - * - * @param manager Entry point to PostgreSqlManager. - */ - public static void serverUpdateWithCustomerMaintenanceWindow( - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { Server resource = manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc4", Context.NONE).getValue(); resource .update() - .withMaintenanceWindow( - new MaintenanceWindow() - .withCustomWindow("Enabled") - .withStartHour(8) - .withStartMinute(0) - .withDayOfWeek(0)) - .withCreateMode(CreateModeForUpdate.UPDATE) + .withAdministratorLoginPassword("") + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) .apply(); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesCreateOrUpdateSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..6fe056b3d5a2 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/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.postgresqlflexibleserver.generated; + +/** Samples for VirtualNetworkRules CreateOrUpdate. */ +public final class VirtualNetworkRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json + */ + /** + * Sample code: Create or update a virtual network rule. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void createOrUpdateAVirtualNetworkRule( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager 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/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesDeleteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesDeleteSamples.java new file mode 100644 index 000000000000..92c3dd18a648 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Delete. */ +public final class VirtualNetworkRulesDeleteSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json + */ + /** + * Sample code: Delete a virtual network rule. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void deleteAVirtualNetworkRule( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.virtualNetworkRules().delete("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesGetSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesGetSamples.java new file mode 100644 index 000000000000..8f22214ad7bd --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Get. */ +public final class VirtualNetworkRulesGetSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json + */ + /** + * Sample code: Gets a virtual network rule. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void getsAVirtualNetworkRule( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.virtualNetworkRules().getWithResponse("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesListByServerSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesListByServerSamples.java new file mode 100644 index 000000000000..fd9b80809c44 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkRulesListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules ListByServer. */ +public final class VirtualNetworkRulesListByServerSamples { + /* + * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json + */ + /** + * Sample code: List virtual network rules. + * + * @param manager Entry point to PostgreSqlManager. + */ + public static void listVirtualNetworkRules( + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { + manager.virtualNetworkRules().listByServer("TestGroup", "vnet-test-svr", Context.NONE); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.java deleted file mode 100644 index 15238a072608..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/samples/java/com/azure/resourcemanager/postgresqlflexibleserver/generated/VirtualNetworkSubnetUsageExecuteSamples.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.generated; - -import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; - -/** Samples for VirtualNetworkSubnetUsage Execute. */ -public final class VirtualNetworkSubnetUsageExecuteSamples { - /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/VirtualNetworkSubnetUsage.json - */ - /** - * Sample code: VirtualNetworkSubnetUsageList. - * - * @param manager Entry point to PostgreSqlManager. - */ - public static void virtualNetworkSubnetUsageList( - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager) { - manager - .virtualNetworkSubnetUsages() - .executeWithResponse( - "westus", - new VirtualNetworkSubnetUsageParameter() - .withVirtualNetworkArmResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet"), - Context.NONE); - } -}